Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffce497e3f | ||
|
|
f3546d79b1 | ||
|
|
552d79f964 | ||
|
|
109858572f | ||
|
|
34f288be5d | ||
|
|
a8bb95aa51 | ||
|
|
117e21a8b2 | ||
|
|
51e0b8ce4f | ||
|
|
bce4dcbc5d | ||
|
|
4268604cb6 | ||
|
|
15bc2c7ca1 | ||
|
|
1389237f97 | ||
|
|
95399c64cd | ||
|
|
02ca455e92 | ||
|
|
e1aff10478 | ||
|
|
e3636825fb | ||
|
|
9beeb038ff | ||
|
|
0019cfb7c0 | ||
|
|
c057f636e3 | ||
|
|
1868d5914a | ||
|
|
8bfb1d1e95 |
No files matched your search
@@ -33,4 +33,5 @@ trace_data/
|
||||
/src/lib/orderman/perf_analysis/log.csv
|
||||
/doc/user/public/*
|
||||
.ionide/*
|
||||
*.ionide
|
||||
/.ignore
|
||||
Vendored
+3
-8
@@ -5,9 +5,7 @@
|
||||
"includePath": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}",
|
||||
"${workspaceFolder}/src",
|
||||
"${workspaceRoot}/externals/linux/include"
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [],
|
||||
"intelliSenseMode": "clang-x64",
|
||||
@@ -15,16 +13,13 @@
|
||||
"path": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}",
|
||||
"${workspaceFolder}/src",
|
||||
"${workspaceRoot}/externals/linux/include"
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
},
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++17",
|
||||
"compileCommands": "${workspaceFolder}/build/ninja_debug/compile_commands.json"
|
||||
"cppStandard": "c++17"
|
||||
},
|
||||
{
|
||||
"name": "Windows",
|
||||
|
||||
Vendored
+10
-19
@@ -14,21 +14,24 @@
|
||||
"focus": false,
|
||||
"panel": "shared"
|
||||
},
|
||||
"group": "build"
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "server_build",
|
||||
"label": "server_build",
|
||||
"type": "shell",
|
||||
"command": ".\\tools\\buildsparkd.cmd",
|
||||
"problemMatcher": {
|
||||
"base": "$gcc",
|
||||
"problemMatcher": {
|
||||
"base": "$gcc",
|
||||
"owner": "cpp",
|
||||
"fileLocation": [
|
||||
"relative",
|
||||
"${workspaceFolder}"
|
||||
"${workspaceFolder}"
|
||||
],
|
||||
"pattern": {
|
||||
"regexp": "(.?)(home)(.?)(bts)(.?)(spark)(.?)(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)",
|
||||
"regexp": "(.?)(home)(.?)(bts)(.?)(spark)(.?)(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)",
|
||||
"file": 8,
|
||||
"line": 9,
|
||||
"column": 10,
|
||||
@@ -46,18 +49,6 @@
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "linux build (Debug)",
|
||||
"type": "shell",
|
||||
"command": "cd build/ninja_debug; time ninja",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
+++
|
||||
title="Client API"
|
||||
redirect_to = "client/getting-started/overview/"
|
||||
template="client.html"
|
||||
sort_by="weight"
|
||||
+++
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
+++
|
||||
title="Getting Started"
|
||||
template="client.html"
|
||||
sort_by="weight"
|
||||
weight = 1
|
||||
+++
|
||||
|
||||
@@ -1,25 +1,9 @@
|
||||
+++
|
||||
title = "Install Prerequisites"
|
||||
weight = 10
|
||||
template="client.html"
|
||||
weight = 1
|
||||
+++
|
||||
|
||||
# C#/.NET
|
||||
|
||||
We target [.NET Standard 2.0](https://docs.microsoft.com/en-us/dotnet/standard/net-standard) so you can use .NET Framework 4.6.1+ or .NET Core 2.0+. Simply add a reference to the [Spark Nuget package](https://nuget.org) to get started.
|
||||
|
||||
```
|
||||
dotnet new console -lang c#
|
||||
dotnet add package spark_sdk
|
||||
dotnet build
|
||||
```
|
||||
|
||||
# C++
|
||||
|
||||
The easiest way to get started with C++ is to use the Spark Server SDK to develop your application. Follow the instructions to [download and install the Spark Server SDK](/server/getting-started/install) and open the client_sdk sample project. If you want to run your C++ Client SDK application on Windows [contact us](mailto://api@bluetradesys.com) to get the required headers and binaries.
|
||||
|
||||
# JavaScript
|
||||
|
||||
We use JavaScript internally with the Spark Client API over a websocket connection but the documentation and packaging isn't ready yet. If this is something you're interested in get in touch with us at [api@bluetradesys.com](mailto:api@bluetradesys.com).
|
||||
|
||||
|
||||
## Coming Soon
|
||||
|
||||
* Install .net core
|
||||
@@ -1,31 +0,0 @@
|
||||
+++
|
||||
title = "Overview"
|
||||
weight = 1
|
||||
+++
|
||||
|
||||
The Spark Client SDK is a high level command and control API which can be used to build scripts or integrate Spark into your existing ecosystem. The API is divided into several independent **"services"** responsible for different aspects of the system. A Service can define both [remote procedure call (RPC)](/client/getting-started/services#rpc) and incremental [streaming](/client/getting-started/services#streams) data.
|
||||
|
||||
The [Spark Desktop](https://www.bluetradingsystems.com/bts-spark/) is built on top of this API so you can be assured that it is complete and well tested.
|
||||
|
||||
Spark uses [Google Protocol Buffers](https://developers.google.com/protocol-buffers/) as an interface definition language similar to [GRPC](https://grpc.io) but backed by our custom high-performance TCP protocol. We currently support C#/.NET and C++ <!--and Javascript--> but the architecture is designed for easy extension so contact us about your specific business needs.
|
||||
|
||||
## Orders
|
||||
|
||||
Use the [OrderService](/client/services/orderservice) to send and manage orders including native exchange orders, spreader orders, and custom Algo orders created using the [Spark Server SDK](https://api.bluetradesys.com/server/).
|
||||
|
||||
## Spreader
|
||||
|
||||
Use the [SyntheticSecurityService](/client/services/syntheticsecurityservice) to create and manage synthetic spreads. Once created these spreads show up in the security and market data feeds just like exchange listed spreads.
|
||||
|
||||
## Position
|
||||
|
||||
Use the [PositionService](/client/services/positionservice) to get your position and P&L reports or add fills manually to keep the Spark system up to date with an external system.
|
||||
|
||||
## Administration
|
||||
|
||||
Use the [AdminService](/client/services/adminservice) to manage users and control limits.
|
||||
|
||||
## Market Data
|
||||
|
||||
For .NET subscribe to market data though the high level MarketDataClient interface. From C++ or JavaScript use the MarketDataRelay service directly.
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
+++
|
||||
title = "Services"
|
||||
weight = 20
|
||||
+++
|
||||
|
||||
The Spark Client SDK uses [Google Protocol Buffers](https://developers.google.com/protocol-buffers/) to define the interface for each service in a language independent manner. Services have both functions which return a single result and streams of data which return values continuously while subscribed. This page describes the mapping from the Protocol Buffer definition to the concrete definition in each supported language.
|
||||
|
||||
# ServiceContext
|
||||
|
||||
To connect your client to the Spark Server you need to get or create a `ServiceContext` instance. A `ServiceContext` represents a connection to the Spark Server and a background thread for handling messages on that connection. Generally there should be a single `ServiceContext` per process. All of the methods on the `ServiceContext` are safe thread safe.
|
||||
|
||||
Construct a ServiceContext by calling the default constructor. The ServiceContext will find the Spark Server by loading the server configuration over an HTTP connection. To determine the URL it will search the following locations and use the first one that is present.
|
||||
|
||||
* A command line argument `-configserver <url>`
|
||||
* An environment variable `BTSCONFIG`
|
||||
* `%APPDATA%/bts/conf/spark.conf` (Windows)
|
||||
* /sparkdata/conf/spark.conf (Linux)
|
||||
* $HOME/sparkdata/conf/spark.conf (Linux)
|
||||
|
||||
If your application is running on a system with the BTS Client installed this will probably work without any further configuration. If you plan to run your client application on a separate machine we recommend setting the `BTSCONFIG` environment variable.
|
||||
|
||||
<div class="info">
|
||||
<i class="fa fa-lightbulb-o fa-fw" aria-hidden="true"></i>
|
||||
If you are using the Spark Server SDK to run a local copy of the Spark server set <p><strong>BTSCONFIG = http://localhost:9000/config/</strong></p>
|
||||
</div>
|
||||
|
||||
To get a proxy for a given service call ServiceContext.locate<T>("qualifier") where T is the type of the service and "qualifier" is an optional qualifier used to disambiguate between 2 instances of the same service. The locate call cannot fail but it may return a disconnected proxy. When you make a call on the proxy you should check the call result to see if the method call succeeded.
|
||||
|
||||
# RPC
|
||||
|
||||
Here is the OrderService reduced to a single method definition. A RPC method always takes exactly 1 argument and returns 1 value. In this example the `create_order` call takes a `Create` instance and returns a `Response`.
|
||||
|
||||
```C
|
||||
service OrderService {
|
||||
rpc create_order(Create) returns (Response);
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
The `Create` and `Response` types are also defined as protocol buffer messages. Each field can either be a primitive type another message or a list or map.
|
||||
|
||||
```C
|
||||
message Create {
|
||||
OrderDefinition new_order = 1;
|
||||
double price = 2;
|
||||
uint32 quantity = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
uint32 order_key = 1;
|
||||
OrderError error_code = 2;
|
||||
string msg = 3;
|
||||
}
|
||||
```
|
||||
|
||||
Each RPC call generates both synchronous (blocking) and asynchronous variants. In C# the asynchronous calls have the `_async` suffix and return a `Task`. In C++ the call is overloaded to either return a value synchronously or accept a callback function to be called on the ServiceContext thread when the call completes. <!-- In Javascript only async methods returning a Promise are generated because it never makes sense to make a blocking call in the browser. -->
|
||||
|
||||
To call the resulting service locate a proxy using the [ServiceContext](#servicecontext) and then call `cancel_order` or `cancel_order_async`. If you are calling the Spark API from a GUI application you should always prefer the `_async` version of the calls.
|
||||
|
||||
|
||||
### C# example
|
||||
```c#
|
||||
var ctx = new ServiceContext();
|
||||
var orders = ctx.locate<OrderService>();
|
||||
var response =
|
||||
await orders.create_order_async(
|
||||
new Create { price = 2.25, quantity = 42 });
|
||||
if (response.success) {
|
||||
Console.WriteLine($"success: {response.value}");
|
||||
}
|
||||
else {
|
||||
Console.WriteLine($"Error: {response.error_message}");
|
||||
}
|
||||
```
|
||||
### C++ example
|
||||
```cpp
|
||||
auto ctx = ServiceContext{};
|
||||
auto orders = ctx.locate<OrderService>();
|
||||
Create c;
|
||||
c.set_price(2.25);
|
||||
c.set_quantity(42);
|
||||
// Instead of providing an _async method C++ uses overloading.
|
||||
// To make a syncronous call simply omit the callback
|
||||
orders.create_order(c, [=](const Result<Response>& response) {
|
||||
if(response.success()) {
|
||||
std::cout << "success.";
|
||||
}
|
||||
else {
|
||||
std::cout << "error: " << response.error_message();
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
# Streams
|
||||
|
||||
Streams allow you to subscribe to live updating data. Each stream represents a changing collection of protocol buffer objects. Similar to a database row each item has an `id` which uniquely identifies it within the collection. Updates from the Spark server can add, remove or replace entries in the collection. Since only the changed items are sent over the wire the stream can remain responsive even when it represents a large collection.
|
||||
|
||||
Streams are implemented using the language bindings for [ReativeX](http://reactivex.io/) which provide utility functions to drill down to the specific data your application needs. In C# we provide both mutable and immutable versions of the generated data types (C++ users can rely on `const`).
|
||||
|
||||
When defined in a proto file streams use the `stream` keyword on the result type.
|
||||
```C
|
||||
service OrderService {
|
||||
...
|
||||
rpc fills (FillsSub) returns (stream Fill);
|
||||
}
|
||||
```
|
||||
|
||||
### C# example
|
||||
```c#
|
||||
var sc = new ServiceContext();
|
||||
var orders = sc.locate<OrderService>();
|
||||
var fills_observable = orders.subscribei_fills();
|
||||
var unsub = fills_observable.Subscribe(update => {
|
||||
Console.WriteLine(
|
||||
"Added {0} items, Removed {1} items, Updated {2} items. Total items {3}",
|
||||
update.added.Count(),
|
||||
update.removed.Count(),
|
||||
update.changes.Count(),
|
||||
update.all.Count());
|
||||
});
|
||||
|
||||
Thread.Sleep(TimeSpan.FromMinutes(5));
|
||||
unsub.Dispose();
|
||||
```
|
||||
### C++ Example
|
||||
```cpp
|
||||
```
|
||||
@@ -1,6 +0,0 @@
|
||||
+++
|
||||
title="Samples"
|
||||
sort_by="weight"
|
||||
weight = 30
|
||||
+++
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
+++
|
||||
title = "AdminService"
|
||||
+++
|
||||
@@ -1,3 +0,0 @@
|
||||
+++
|
||||
title = "OrderService"
|
||||
+++
|
||||
@@ -1,3 +0,0 @@
|
||||
+++
|
||||
title = "PositionService"
|
||||
+++
|
||||
@@ -1,3 +0,0 @@
|
||||
+++
|
||||
title = "SyntheticService"
|
||||
+++
|
||||
@@ -1,6 +0,0 @@
|
||||
+++
|
||||
title="Services"
|
||||
#sort_by="weight"
|
||||
weight = 10
|
||||
+++
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
+++
|
||||
title = "Market Data"
|
||||
+++
|
||||
@@ -1,5 +1,6 @@
|
||||
+++
|
||||
title="Algo API"
|
||||
template="documentation.html"
|
||||
redirect_to = "server/getting-started/overview/"
|
||||
sort_by="weight"
|
||||
+++
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
+++
|
||||
title="Getting Started"
|
||||
template="documentation.html"
|
||||
sort_by="weight"
|
||||
weight = 1
|
||||
+++
|
||||
|
||||
@@ -5,7 +5,7 @@ weight = 2
|
||||
|
||||
## Request Access 🔑
|
||||
|
||||
To start using the Server SDK you will need to request access though our sales department. Please email <a href="mailto:api@bluetradesys.com">api@bluetradesys.com</a> or call <a href="tel:919-913-0850">(919) 913-0850</a> and we will provide download credentials.
|
||||
To start using the Server SDK you will need to request access though our sales department. Please email <a href="mailto:info@bluetradesys.com">info@bluetradesys.com</a> or call <a href="tel:919-913-0850">(919) 913-0850</a> and we will provide download credentials.
|
||||
|
||||
## Download
|
||||
|
||||
|
||||
File renamed without changes.
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
@@ -1,5 +1,6 @@
|
||||
+++
|
||||
title="Reference"
|
||||
template="documentation.html"
|
||||
sort_by="weight"
|
||||
weight = 2
|
||||
+++
|
||||
|
||||
@@ -6,9 +6,3 @@ weight = 40
|
||||
## I need to make a call that might take a few seconds. What is the best way to do this?
|
||||
|
||||
Create a background thread in [do_before_launch](/server/ref/initialization#before-launch) or [do_launch](/server/ref/initialization#launch-launch-attached) to do the work. Use [on_timer](/server/ref/subscriptions#timer) to poll until the result is available.
|
||||
|
||||
## I don't see the header files in the .zip file. Where are they?
|
||||
|
||||
The SDK headers are baked into the docker image along with the build tools. Once you've loaded the image with `docker load < spark_sdk.img` you can run this command to copy them out to your local file system `docker run --rm -it -v $PWD:/out spark_sdk /bin/tar -cvf /out/headers.tar /sdk/include` This will copy the headers to the current directory in headers.tar. We still recommend doing the actual build inside the docker environment but having a copy of the headers can be useful for setting up your development environment.
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
+++
|
||||
title="Samples"
|
||||
template="documentation.html"
|
||||
sort_by="weight"
|
||||
weight = 3
|
||||
+++
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
{% extends "index.html" %}
|
||||
|
||||
{% block extra_nav_class %}{% endblock extra_nav_class %}
|
||||
{% block extra_content_class %}content--reversed{% endblock extra_content_class %}
|
||||
|
||||
{% block content %}
|
||||
{% set section = get_section(path="client/_index.md") %}
|
||||
<div class="documentation">
|
||||
<aside class="documentation__sidebar">
|
||||
<ul>
|
||||
{% for p in section.subsections %}
|
||||
{% set subsection = get_section(path=p) %}
|
||||
<li>
|
||||
<span class="documentation__sidebar__title">{{ subsection.title }}</span>
|
||||
<ul>
|
||||
{% for page in subsection.pages %}
|
||||
<li class="{% if current_path == page.path %}active{% endif %}">
|
||||
<a href="{{page.permalink}}">{{page.title}}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</aside>
|
||||
<div class="documentation__content">
|
||||
{% block doc_content %}
|
||||
{% endblock doc_content %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
@@ -0,0 +1,36 @@
|
||||
{% extends "index.html" %}
|
||||
|
||||
{% block extra_nav_class %}{% endblock extra_nav_class %}
|
||||
{% block extra_content_class %}content--reversed{% endblock extra_content_class %}
|
||||
|
||||
{% block content %}
|
||||
{%if page.extra.section %}
|
||||
{% set section = get_section(path="{{page.extra.section}}/_index.md") %}
|
||||
{% else %}
|
||||
{% set section = get_section(path="server/_index.md") %}
|
||||
{% endif %}
|
||||
<div class="documentation">
|
||||
<aside class="documentation__sidebar">
|
||||
<ul>
|
||||
{% for p in section.subsections %}
|
||||
{% set subsection = get_section(path=p) %}
|
||||
<li>
|
||||
<span class="documentation__sidebar__title">{{ subsection.title }}</span>
|
||||
<ul>
|
||||
{% for page in subsection.pages %}
|
||||
<li class="{% if current_path == page.path %}active{% endif %}">
|
||||
<a href="{{page.permalink}}">{{page.title}}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</aside>
|
||||
<div class="documentation__content">
|
||||
{% block doc_content %}
|
||||
{% endblock doc_content %}
|
||||
{% block next_link %} {% endblock next_link %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us">
|
||||
<html lang="en-gb">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
@@ -14,7 +14,6 @@
|
||||
<link rel="stylesheet" href="{{ get_url(path="site.css") }}"/>
|
||||
<link rel="icon" href="{{ get_url(path="favicon.ico") }}">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||
<script> dataLayer = [{ 'visitorType': 'geek' }]; </script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -37,13 +36,13 @@
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<div class="content content--reversed">
|
||||
<div class="content {% block extra_content_class %}{% endblock extra_content_class %}">
|
||||
{% block content %}
|
||||
<div class="hero">
|
||||
<h1>Spark SDK</h1>
|
||||
<p class="hero__tagline">
|
||||
Spark consists of a client UI
|
||||
(<a href="https://www.bluetradingsystems.com/bts-spark#ladder-algo-screen">Spark Client</a>),
|
||||
(<a class="white" href="https://www.bluetradingsystems.com/bts-spark#ladder-algo-screen">Spark Client</a>),
|
||||
a high-performance professional futures front end, connected via our proprietary protocol over TCP to our Spark Server, which in turn connects to execution venues via their native protocols.
|
||||
Use the Spark SDK to extend Spark Server with your custom Algos, then use the Client SDK to launch and control them.
|
||||
</p>
|
||||
@@ -65,7 +64,7 @@
|
||||
<a href="{{ get_url(path="@/server/_index.md") }}" class="button">Get started</a>
|
||||
</div>
|
||||
|
||||
<div class="selling-point">
|
||||
<div class="selling-point disabled">
|
||||
<h2>
|
||||
Client SDK
|
||||
<i class="fa fa-gamepad" aria-hidden="true"></i>
|
||||
@@ -73,9 +72,19 @@
|
||||
<p>
|
||||
The Spark client SDK allows you to integrate spark with your existing ecosystem. The Spark Client is built entirely on this simple, powerful API.
|
||||
</p>
|
||||
<a href="" class="button">Get started</a>
|
||||
<a href="" class="button" disabled>Get started</a>
|
||||
</div>
|
||||
|
||||
<!-- <div class="selling-point disabled">
|
||||
<h2>
|
||||
Microsoft Excel
|
||||
<i class="fa fa-table" aria-hidden="true"></i>
|
||||
</h2>
|
||||
<p>
|
||||
More of your business is built on excel than probably should be. Continue this worrying trend with the Spark Excel API.
|
||||
</p>
|
||||
<a href="" class="button" disabled>Get started</a>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -85,15 +94,6 @@
|
||||
© Blue Trading Systems
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
if (location.hostname == "api.bluetradesys.com") {
|
||||
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||
})(window,document,'script','dataLayer','GTM-56FHG8R');
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript" src="{{ get_url(path="elasticlunr.min.js") }}"></script>
|
||||
<script type="text/javascript" src="{{ get_url(path="search_index.en.js") }}"></script>
|
||||
<script type="text/javascript" src="{{ get_url(path="search.js") }}"></script>
|
||||
|
||||
@@ -1,39 +1,13 @@
|
||||
{% extends "index.html" %}
|
||||
{# this has access to the "page" variable but documentation.html does not #}
|
||||
{% extends "documentation.html" %}
|
||||
|
||||
{% block title %}{{ page.title }} | {{ super() }} {% endblock title %}
|
||||
{% block doc_content %}
|
||||
<h1>{{page.title}}</h1>
|
||||
{{page.content | safe}}
|
||||
{% endblock doc_content %}
|
||||
|
||||
{% block next_link %}
|
||||
{% endblock next_link %}
|
||||
|
||||
{% block content %}
|
||||
{% set section = get_section(path=page.ancestors[1]) %}
|
||||
{#
|
||||
{#<div>{{ section.title }} </div>#}
|
||||
<div class="documentation">
|
||||
<aside class="documentation__sidebar">
|
||||
<ul>
|
||||
{% for p in section.subsections %}
|
||||
{% set subsection = get_section(path=p) %}
|
||||
<li>
|
||||
<span class="documentation__sidebar__title">{{ subsection.title }}</span>
|
||||
<ul>
|
||||
{% for page in subsection.pages %}
|
||||
<li class="{% if current_path == page.path %}active{% endif %}">
|
||||
<a href="{{page.permalink}}">{{page.title}}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</aside>
|
||||
<div class="documentation__content">
|
||||
<h1>{{page.title}}</h1>
|
||||
{{page.content | safe}}
|
||||
|
||||
{# next/pre links #}
|
||||
<p>
|
||||
<p>
|
||||
{% if page.lighter %}
|
||||
<a href="{{ page.lighter.permalink }}">
|
||||
<i class="fa fa-chevron-left fa-fw" aria-hidden="true"></i>
|
||||
@@ -47,7 +21,5 @@
|
||||
<i class="fa fa-chevron-right fa-fw" aria-hidden="true"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
</p>
|
||||
{% endblock next_link %}
|
||||
@@ -1 +1 @@
|
||||
set(sources /spark/doc/user/build.sh;content/_index.md;content/bts_spark/Glossary/_index.md;content/bts_spark/Help/_index.md;content/bts_spark/Help/about_spark.png;content/bts_spark/Help/image39.png;content/bts_spark/Help/image58.png;content/bts_spark/Launcher/_index.md;content/bts_spark/Launcher/image38.png;content/bts_spark/Launcher/image68.png;content/bts_spark/Logging-In-to-the-System/_index.md;content/bts_spark/Logging-In-to-the-System/image3.png;content/bts_spark/Logging-In-to-the-System/image64.png;content/bts_spark/Market/_index.md;content/bts_spark/Market/change_securities.png;content/bts_spark/Market/image11.png;content/bts_spark/Market/image14.png;content/bts_spark/Market/image20.png;content/bts_spark/Market/image21.png;content/bts_spark/Market/image23.png;content/bts_spark/Market/image24.png;content/bts_spark/Market/image34.png;content/bts_spark/Market/image49.png;content/bts_spark/Market/image53.png;content/bts_spark/Market/image66.png;content/bts_spark/Market/image69.png;content/bts_spark/Market/market_view.png;content/bts_spark/Market/settings_icon.png;content/bts_spark/Market/time_and_sales.png;content/bts_spark/My-Windows/_index.md;content/bts_spark/My-Windows/image15.png;content/bts_spark/My-Windows/image16.png;content/bts_spark/My-Windows/image37.png;content/bts_spark/Settings/_index.md;content/bts_spark/Settings/image51.png;content/bts_spark/Settings/image9.png;content/bts_spark/Spreader/_index.md;content/bts_spark/Spreader/image10.png;content/bts_spark/Spreader/image13.png;content/bts_spark/Spreader/image18.png;content/bts_spark/Spreader/image19.png;content/bts_spark/Spreader/image28.png;content/bts_spark/Spreader/image29.png;content/bts_spark/Spreader/image31.png;content/bts_spark/Spreader/image35.png;content/bts_spark/Spreader/image40.png;content/bts_spark/Spreader/image43.png;content/bts_spark/Spreader/image54.png;content/bts_spark/Spreader/image55.png;content/bts_spark/Spreader/image56.png;content/bts_spark/Spreader/image6.png;content/bts_spark/Spreader/image7.png;content/bts_spark/Spreader/image70.png;content/bts_spark/Spreader/image72.png;content/bts_spark/Spreader/image8.png;content/bts_spark/Trading/OrderTypes/index.md;content/bts_spark/Trading/_index.md;content/bts_spark/Trading/algo_studio.png;content/bts_spark/Trading/collapse_all_icon.png;content/bts_spark/Trading/cover_algo_control.png;content/bts_spark/Trading/expand_all_icon.png;content/bts_spark/Trading/image1.png;content/bts_spark/Trading/image17.png;content/bts_spark/Trading/image2.png;content/bts_spark/Trading/image25.png;content/bts_spark/Trading/image27.png;content/bts_spark/Trading/image33.png;content/bts_spark/Trading/image42.png;content/bts_spark/Trading/image44.png;content/bts_spark/Trading/image47.png;content/bts_spark/Trading/image48.png;content/bts_spark/Trading/image5.png;content/bts_spark/Trading/image50.png;content/bts_spark/Trading/image52.png;content/bts_spark/Trading/image57.png;content/bts_spark/Trading/image59.png;content/bts_spark/Trading/image60.png;content/bts_spark/Trading/image61.png;content/bts_spark/Trading/image62.png;content/bts_spark/Trading/image73.png;content/bts_spark/Trading/image74.png;content/bts_spark/Trading/join_algo_control.png;content/bts_spark/Trading/ladder.png;content/bts_spark/Trading/ladder_badges.png;content/bts_spark/Trading/ladder_main_part.png;content/bts_spark/Trading/lean_algo_control.png;content/bts_spark/Trading/mini_orderbook.png;content/bts_spark/Trading/oco_algo_control.png;content/bts_spark/Trading/offset_algo_control.png;content/bts_spark/Trading/pnl_calculation.png;content/bts_spark/Trading/pnl_window.png;content/bts_spark/Trading/recreate_icon.png;content/bts_spark/Trading/settings_icon.png;content/bts_spark/Trading/spark_menu_order_book.png;content/bts_spark/Trading/top_algo_control.png;content/bts_spark/Trading/trigger_algo_control.png;content/bts_spark/_index.md;content/release_notes/_index.md;content/system_requirements/_index.md;static/book.js;static/favicon.ico;static/image.js;templates/index.html;templates/page.html;templates/section.html;templates/shortcodes/back_button.html)
|
||||
set(sources /home/ppinto/Dropbox/bts/spark/doc/user/build.sh;content/_index.md;content/bts_spark/Glossary/_index.md;content/bts_spark/Help/_index.md;content/bts_spark/Help/about_spark.png;content/bts_spark/Help/image39.png;content/bts_spark/Help/image58.png;content/bts_spark/Launcher/_index.md;content/bts_spark/Launcher/image38.png;content/bts_spark/Launcher/image68.png;content/bts_spark/Logging-In-to-the-System/_index.md;content/bts_spark/Logging-In-to-the-System/image3.png;content/bts_spark/Logging-In-to-the-System/image64.png;content/bts_spark/Market/_index.md;content/bts_spark/Market/change_securities.png;content/bts_spark/Market/image11.png;content/bts_spark/Market/image14.png;content/bts_spark/Market/image20.png;content/bts_spark/Market/image21.png;content/bts_spark/Market/image23.png;content/bts_spark/Market/image24.png;content/bts_spark/Market/image34.png;content/bts_spark/Market/image49.png;content/bts_spark/Market/image53.png;content/bts_spark/Market/image66.png;content/bts_spark/Market/image69.png;content/bts_spark/Market/market_view.png;content/bts_spark/Market/settings_icon.png;content/bts_spark/Market/time_and_sales.png;content/bts_spark/My-Windows/_index.md;content/bts_spark/My-Windows/image15.png;content/bts_spark/My-Windows/image16.png;content/bts_spark/My-Windows/image37.png;content/bts_spark/Settings/_index.md;content/bts_spark/Settings/image51.png;content/bts_spark/Settings/image9.png;content/bts_spark/Spreader/_index.md;content/bts_spark/Spreader/image10.png;content/bts_spark/Spreader/image13.png;content/bts_spark/Spreader/image18.png;content/bts_spark/Spreader/image19.png;content/bts_spark/Spreader/image28.png;content/bts_spark/Spreader/image29.png;content/bts_spark/Spreader/image31.png;content/bts_spark/Spreader/image35.png;content/bts_spark/Spreader/image40.png;content/bts_spark/Spreader/image43.png;content/bts_spark/Spreader/image54.png;content/bts_spark/Spreader/image55.png;content/bts_spark/Spreader/image56.png;content/bts_spark/Spreader/image6.png;content/bts_spark/Spreader/image7.png;content/bts_spark/Spreader/image70.png;content/bts_spark/Spreader/image72.png;content/bts_spark/Spreader/image8.png;content/bts_spark/Trading/OrderTypes/index.md;content/bts_spark/Trading/_index.md;content/bts_spark/Trading/algo_studio.png;content/bts_spark/Trading/collapse_all_icon.png;content/bts_spark/Trading/cover_algo_control.png;content/bts_spark/Trading/expand_all_icon.png;content/bts_spark/Trading/image1.png;content/bts_spark/Trading/image17.png;content/bts_spark/Trading/image2.png;content/bts_spark/Trading/image25.png;content/bts_spark/Trading/image27.png;content/bts_spark/Trading/image33.png;content/bts_spark/Trading/image42.png;content/bts_spark/Trading/image44.png;content/bts_spark/Trading/image47.png;content/bts_spark/Trading/image48.png;content/bts_spark/Trading/image5.png;content/bts_spark/Trading/image50.png;content/bts_spark/Trading/image52.png;content/bts_spark/Trading/image57.png;content/bts_spark/Trading/image59.png;content/bts_spark/Trading/image60.png;content/bts_spark/Trading/image61.png;content/bts_spark/Trading/image62.png;content/bts_spark/Trading/image73.png;content/bts_spark/Trading/image74.png;content/bts_spark/Trading/join_algo_control.png;content/bts_spark/Trading/ladder.png;content/bts_spark/Trading/ladder_badges.png;content/bts_spark/Trading/ladder_main_part.png;content/bts_spark/Trading/lean_algo_control.png;content/bts_spark/Trading/mini_orderbook.png;content/bts_spark/Trading/oco_algo_control.png;content/bts_spark/Trading/offset_algo_control.png;content/bts_spark/Trading/pnl_calculation.png;content/bts_spark/Trading/pnl_window.png;content/bts_spark/Trading/recreate_icon.png;content/bts_spark/Trading/settings_icon.png;content/bts_spark/Trading/spark_menu_order_book.png;content/bts_spark/Trading/top_algo_control.png;content/bts_spark/Trading/trigger_algo_control.png;content/bts_spark/_index.md;content/release_notes/_index.md;content/system_requirements/_index.md;static/book.js;static/favicon.ico;static/image.js;templates/index.html;templates/page.html;templates/section.html;templates/shortcodes/back_button.html)
|
||||
@@ -4,15 +4,6 @@ weight = 3
|
||||
sort_by = "weight"
|
||||
insert_anchor_links = "right"
|
||||
+++
|
||||
## 2.15.3
|
||||
### Bug Fixes
|
||||
- Fixed a bug where some CME currency spreads exhibited incorrect tick values
|
||||
## 2.15.2
|
||||
### User Visible Changes
|
||||
- Excel RTD plugin can now receive ICE market data
|
||||
## 2.15.1
|
||||
### Bug Fixes
|
||||
- Fixed a FIX log parsing issue that resulted in exchange gateway logon problems
|
||||
## 2.15.0
|
||||
### User Visible Changes
|
||||
- Added ability to hide Ladder status messages via Ladder Settings -> Left Panel tab -> Show/Hide groupbox -> Status Message
|
||||
|
||||
@@ -115,34 +115,22 @@ namespace mbts.ui.shell
|
||||
{
|
||||
try
|
||||
{
|
||||
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\BTS\\stunnel\\";
|
||||
Log.Ui.warn($"Looking for stunnel in {path}");
|
||||
start_stunnel_from_path(path);
|
||||
path = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).FullName + "\\stunnel\\";
|
||||
Log.Ui.warn($"Looking for stunnel in {path}");
|
||||
start_stunnel_from_path(path);
|
||||
path = "C:\\Program Files (x86)\\BTS\\stunnel\\";
|
||||
Log.Ui.warn($"Last Time Looking for stunnel in {path}");
|
||||
start_stunnel_from_path(path);
|
||||
var path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\BTS\\stunnel\\";
|
||||
if (File.Exists(path + "config\\stunnel.conf"))
|
||||
{
|
||||
uint job_error = BTSUINativeMethods.setup_process_job_object();
|
||||
//if we can't put this process and stunnel into a job, try to stop stunnel then restart
|
||||
if(job_error != 0)
|
||||
kill_stunnel();
|
||||
start_stunnel(path, job_error);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch(Exception ex)
|
||||
{
|
||||
stunnel_job_error = "Error starting stunnel: " + ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private void start_stunnel_from_path(string path)
|
||||
{
|
||||
if (File.Exists(path + "config\\stunnel.conf"))
|
||||
{
|
||||
uint job_error = BTSUINativeMethods.setup_process_job_object();
|
||||
//if we can't put this process and stunnel into a job, try to stop stunnel then restart
|
||||
if (job_error != 0)
|
||||
kill_stunnel();
|
||||
start_stunnel(path, job_error);
|
||||
}
|
||||
}
|
||||
|
||||
public new int Run() {
|
||||
var argv = Environment.GetCommandLineArgs();
|
||||
try {
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
<LangVersion>7.2</LangVersion>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<WarningsAsErrors />
|
||||
<Version>$(major).$(minor).$(patch)</Version>
|
||||
<Version Condition="'$(version)'=='..'">1.0.0</Version>
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../spark_api/spark_api.csproj" />
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<Window
|
||||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
Width="400" Height="265"
|
||||
xmlns:ui="clr-namespace:mbts.ui"
|
||||
xmlns:mbts="clr-namespace:mbts.ui" WindowStartupLocation="CenterScreen"
|
||||
@@ -25,7 +25,7 @@
|
||||
<Hyperlink Command="ApplicationCommands.Open" CommandParameter="/doc/manual/index.html">Manual</Hyperlink-->
|
||||
<Hyperlink Command="ApplicationCommands.Open" CommandParameter="https://www.bluetradingsystems.com">www.bluetradingsystems.com</Hyperlink>
|
||||
</TextBlock>
|
||||
<TextBlock Grid.ColumnSpan="2" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,0,0,10">© Blue Trading Systems 2013 - 2018</TextBlock>
|
||||
<TextBlock Grid.ColumnSpan="2" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,0,0,10">© Blue Trading Systems</TextBlock>
|
||||
<Button HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.ColumnSpan="2" Margin="10" IsDefault="True" Command="ApplicationCommands.Close" MinWidth="60">OK</Button>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -292,9 +292,7 @@ namespace mbts.spark {
|
||||
int count = 0;
|
||||
double factored_base = log10_diff > 0 ? reduced_target_base * Math.Pow(10, Math.Ceiling(log10_diff)) : reduced_target_base;
|
||||
do {
|
||||
// Note that the modulus operator is not used here due to rounding errors.
|
||||
// Such a rounding errror was the cause of the bug https://bluetradesys.atlassian.net/browse/SP-283.
|
||||
if (MathUtils.is_int(factored_base / raw_base))
|
||||
if (factored_base % raw_base == 0)
|
||||
return new TickFactors(factored_base, factored_base / raw_base);
|
||||
factored_base *= 10;
|
||||
} while (++count < 10);
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
dotnet pack
|
||||
dotnet nuget push
|
||||
@@ -3,19 +3,17 @@
|
||||
<TargetFrameworks>netstandard2.0</TargetFrameworks>
|
||||
<Authors>Blue Trading Systems</Authors>
|
||||
<Company>Blue Trading Systems</Company>
|
||||
<Description />
|
||||
<PackageId>Spark_API</PackageId>
|
||||
<Product>Spark</Product>
|
||||
<Description />
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Platforms>x64</Platforms>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<WarningsAsErrors />
|
||||
<Version>$(major).$(minor).$(patch)</Version>
|
||||
<Version Condition="'$(version)'=='..'">0.0.0</Version>
|
||||
<Version>1.0.0</Version>
|
||||
<LangVersion>7.2</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.6.1" />
|
||||
<PackageReference Include="System.Collections.Immutable" Version="1.5.0" />
|
||||
@@ -26,10 +24,12 @@
|
||||
<Proto3 Include="**/*.proto" />
|
||||
<Proto3 Include="../../lib/api/*.proto" />
|
||||
<Proto3 Include="../../lib/api/services/*.proto" />
|
||||
<!--Proto3 Remove="../../lib/api/services/MarketDataRelay.proto" /-->
|
||||
<Proto3 Include="../../lib/md/protos/co2.proto" />
|
||||
<Proto3 Include="../../lib/domain_model/Security.proto" />
|
||||
<Proto3 Include="../../lib/sparkproto/SparkProtos.proto" />
|
||||
<Proto3 Update="../../lib/api/services/OutOfProcessURLListener.proto">
|
||||
<!-- <CompileOptions>internal_access:</CompileOptions> -->
|
||||
</Proto3>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,10 +0,0 @@
|
||||
using Google.Protobuf;
|
||||
namespace bts.api {
|
||||
|
||||
public sealed partial class Product : ICustomDiagnosticMessage {
|
||||
public string ToDiagnosticString() {
|
||||
return $"{this.Symbol}:{this.Type}:{this.Exchange}";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,8 +7,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<WarningsAsErrors />
|
||||
<Version>$(major).$(minor).$(patch)</Version>
|
||||
<Version Condition="'$(version)'=='..'">0.0.0</Version>
|
||||
<Version>1.0.0</Version>
|
||||
<LangVersion>7.2</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -66,23 +66,9 @@ namespace bts.excel.rtd
|
||||
if (string.IsNullOrEmpty(contract))
|
||||
return Observable.Return(new []{"Can't Parse Contract: " + contract ?? string.Empty});
|
||||
|
||||
Func<SecurityImmutable, bool> desc = null;
|
||||
switch(ven)
|
||||
{
|
||||
case Venue.Sim:
|
||||
case Venue.Glbx:
|
||||
desc = (x=> x.Glbx.SecurityDesc == contract);
|
||||
break;
|
||||
case Venue.Ice:
|
||||
desc = (x=> x.Ice.SecurityDesc == contract);
|
||||
break;
|
||||
default:
|
||||
desc = (x => true);
|
||||
break;
|
||||
}
|
||||
Func<SecurityImmutable, bool> where = (x => x.Exchange == ven && x.Symbol == symbol && x.security_type() == sectype &&
|
||||
x.Glbx.SecurityDesc == contract);
|
||||
|
||||
Func<SecurityImmutable, bool> where = (x => x.Exchange == ven && x.Symbol == symbol && x.security_type() == sectype && desc(x) );
|
||||
|
||||
var stream = market_data(ven).subscribe_combined(where);
|
||||
return stream;
|
||||
}
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<WarningsAsErrors />
|
||||
<Version>$(major).$(minor).$(patch)</Version>
|
||||
<Version Condition="'$(version)'=='..'">1.0.0</Version>
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Binary file not shown.
@@ -19,8 +19,6 @@ namespace bts {
|
||||
public bool admin { get; set; }
|
||||
[Option(nameof(latency))]
|
||||
public bool latency { get; set; }
|
||||
[Option("md")]
|
||||
public bool market_data { get; set; }
|
||||
}
|
||||
|
||||
public class ServiceTest {
|
||||
@@ -37,24 +35,9 @@ namespace bts {
|
||||
if (o.latency) {
|
||||
latency_test();
|
||||
}
|
||||
if (o.market_data) {
|
||||
market_data();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static void market_data() {
|
||||
using (var ctx = new ServiceContext()) {
|
||||
var md = ctx.locate<MarketDataService>();
|
||||
md.subscribe_securities().Table().Subscribe(update => {
|
||||
Console.WriteLine($"got {update.state.Count} securities");
|
||||
});
|
||||
while(true) {
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static string try_get(string[] args, int index) {
|
||||
if (args.Length < index) {
|
||||
return args[index];
|
||||
|
||||
@@ -1 +1 @@
|
||||
set(sources api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/service_helpers/AlgoServiceUtils.cpp;api/service_helpers/PositionUtilities.cpp;api/services/AdminService.proto;api/services/AlgoDefinitionService.proto;api/services/AlgoService.proto;api/services/ApiUnitTestService.proto;api/services/AuthService.proto;api/services/BasePositionService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MBOService.proto;api/services/MarginService.proto;api/services/MarketDataAuxiliaryService.proto;api/services/MarketDataRelay.proto;api/services/MarketDataService.proto;api/services/MoneyFileService.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/Symbols.conf;config/defaults/cme_reference_data.conf;config/defaults/edge.conf;config/defaults/jetfix.conf;config/defaults/keycode.conf;config/defaults/logging.conf;config/defaults/orderman_cfg.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/position_cfg.conf;config/defaults/span.conf;config/defaults/spreader.conf;config/defaults/testkeys.conf;config/defaults/threads.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/ExchangeSimCfg.proto;config/protos/MarketData.proto;config/protos/Ports.proto;config/protos/Symbols.proto;config/protos/UI.proto;config/protos/cme_reference_data.proto;config/protos/jetfix.proto;config/protos/keycode.proto;config/protos/logging.proto;config/protos/mercury_cfg.proto;config/protos/orderman_cfg.proto;config/protos/orders_fills_cleanup.proto;config/protos/perflog_cfg.proto;config/protos/position_cfg.proto;config/protos/quickbus_cfg.proto;config/protos/span.proto;config/protos/spreader.proto;config/protos/subprocess.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/threads.proto;config/protos/toggles.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/sod.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;jetfix/codec/FIXArray.cpp;jetfix/common/OutFIX.cpp;jetfix/connection/AsyncReader.cpp;jetfix/connection/IConnection.cpp;jetfix/connection/SocketConnection.cpp;jetfix/gateway/CoreGateway.cpp;jetfix/gateway/JetFIXGateway.cpp;jetfix/gateway/Session.cpp;jetfix/store/FIXFileStore.cpp;jetfix/store/session_name.cpp;jetfix/tests/async_reader_tests.cpp;jetfix/tests/decoding_tests.cpp;jetfix/tests/fix_encoding_stream_tests.cpp;jetfix/tests/fix_fragment_tests.cpp;jetfix/tests/jetfix_performance_tests.cpp;jetfix/tests/sample_fix.cpp;jetfix/tests/store_tests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/Diag/MDPeriodicDumper.cpp;md/Diag/ShmDumper.cpp;md/MBOProcessor.cpp;md/MBOServiceServer.cpp;md/MDClient.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MemorySegmentUtils.cpp;md/PlatformLoader.cpp;md/PriceSize.cpp;md/Product.cpp;md/SecurityCache.cpp;md/SecurityDB.cpp;md/SecurityIDRecorder.cpp;md/SecurityMapper.cpp;md/SecurityOracle.cpp;md/SettlementRecorder.cpp;md/Shm/FixedSecurity.cpp;md/SyntheticSecurityService.cpp;md/cme/MDP3Utils.cpp;md/common.cpp;md/ice/ICEUtils.cpp;md/protos/co2.proto;md/relay/QueryServer.cpp;md/relay/RelayClient.cpp;md/relay/RelayRecorder.cpp;md/service/MarketDataServiceServer.cpp;md/test/Co2ManagedTestHelper.cpp;md/test/Co2TestInstrument.cpp;md/test/mbo_tests.cpp;md/test/md2_tests.cpp;md/test/md_test_utils.cpp;md/test/synthetic_book_merge_tests.cpp;md/vendor/OnixsUtils.cpp;mercury/actors/IPollableActor.cpp;mercury/broker/Broker.cpp;mercury/broker/BrokerProxy.cpp;mercury/broker/ILocalBroker.cpp;mercury/broker/IRemoteBroker.cpp;mercury/common/mercury_common.cpp;mercury/events/TimerEvent.cpp;mercury/executor/Executor.cpp;mercury/topics/Topic.cpp;metrics/metrics.cpp;metricsLine truncated
|
||||
set(sources api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/service_helpers/AlgoServiceUtils.cpp;api/service_helpers/PositionUtilities.cpp;api/services/AdminService.proto;api/services/AlgoDefinitionService.proto;api/services/AlgoService.proto;api/services/ApiUnitTestService.proto;api/services/AuthService.proto;api/services/BasePositionService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MBOService.proto;api/services/MarginService.proto;api/services/MarketDataAuxiliaryService.proto;api/services/MarketDataRelay.proto;api/services/MoneyFileService.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/Symbols.conf;config/defaults/cme_reference_data.conf;config/defaults/edge.conf;config/defaults/jetfix.conf;config/defaults/keycode.conf;config/defaults/logging.conf;config/defaults/orderman_cfg.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/position_cfg.conf;config/defaults/span.conf;config/defaults/spreader.conf;config/defaults/testkeys.conf;config/defaults/threads.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/ExchangeSimCfg.proto;config/protos/MarketData.proto;config/protos/Ports.proto;config/protos/Symbols.proto;config/protos/UI.proto;config/protos/cme_reference_data.proto;config/protos/jetfix.proto;config/protos/keycode.proto;config/protos/logging.proto;config/protos/mercury_cfg.proto;config/protos/orderman_cfg.proto;config/protos/orders_fills_cleanup.proto;config/protos/perflog_cfg.proto;config/protos/position_cfg.proto;config/protos/quickbus_cfg.proto;config/protos/span.proto;config/protos/spreader.proto;config/protos/subprocess.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/threads.proto;config/protos/toggles.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/sod.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;jetfix/codec/FIXArray.cpp;jetfix/common/OutFIX.cpp;jetfix/connection/AsyncReader.cpp;jetfix/connection/IConnection.cpp;jetfix/connection/SocketConnection.cpp;jetfix/gateway/CoreGateway.cpp;jetfix/gateway/JetFIXGateway.cpp;jetfix/gateway/Session.cpp;jetfix/store/FIXFileStore.cpp;jetfix/store/session_name.cpp;jetfix/tests/async_reader_tests.cpp;jetfix/tests/decoding_tests.cpp;jetfix/tests/fix_encoding_stream_tests.cpp;jetfix/tests/fix_fragment_tests.cpp;jetfix/tests/jetfix_performance_tests.cpp;jetfix/tests/sample_fix.cpp;jetfix/tests/store_tests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/Diag/MDPeriodicDumper.cpp;md/Diag/ShmDumper.cpp;md/MBOProcessor.cpp;md/MBOServiceServer.cpp;md/MDClient.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MemorySegmentUtils.cpp;md/PlatformLoader.cpp;md/PriceSize.cpp;md/SecurityCache.cpp;md/SecurityDB.cpp;md/SecurityIDRecorder.cpp;md/SecurityMapper.cpp;md/SecurityOracle.cpp;md/SettlementRecorder.cpp;md/Shm/FixedSecurity.cpp;md/SyntheticSecurityService.cpp;md/cme/MDP3Utils.cpp;md/common.cpp;md/ice/ICEUtils.cpp;md/protos/co2.proto;md/relay/QueryServer.cpp;md/relay/RelayClient.cpp;md/relay/RelayRecorder.cpp;md/test/Co2ManagedTestHelper.cpp;md/test/Co2TestInstrument.cpp;md/test/mbo_tests.cpp;md/test/md2_tests.cpp;md/test/md_test_utils.cpp;md/test/synthetic_book_merge_tests.cpp;md/vendor/OnixsUtils.cpp;mercury/actors/IPollableActor.cpp;mercury/broker/Broker.cpp;mercury/broker/BrokerProxy.cpp;mercury/broker/ILocalBroker.cpp;mercury/broker/IRemoteBroker.cpp;mercury/common/mercury_common.cpp;mercury/events/TimerEvent.cpp;mercury/executor/Executor.cpp;mercury/topics/Topic.cpp;metrics/metrics.cpp;metrics/system_metrics.cpp;orderman/actors/AsyncFactory.cpp;orderman/actors/FillStore.cpp;ordermanLine truncated
|
||||
@@ -1 +1 @@
|
||||
set(sources api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/service_helpers/AlgoServiceUtils.cpp;api/service_helpers/PositionUtilities.cpp;api/services/AdminService.proto;api/services/AlgoDefinitionService.proto;api/services/AlgoService.proto;api/services/ApiUnitTestService.proto;api/services/AuthService.proto;api/services/BasePositionService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MBOService.proto;api/services/MarginService.proto;api/services/MarketDataAuxiliaryService.proto;api/services/MarketDataRelay.proto;api/services/MarketDataService.proto;api/services/MoneyFileService.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/Symbols.conf;config/defaults/cme_reference_data.conf;config/defaults/edge.conf;config/defaults/jetfix.conf;config/defaults/keycode.conf;config/defaults/logging.conf;config/defaults/orderman_cfg.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/position_cfg.conf;config/defaults/span.conf;config/defaults/spreader.conf;config/defaults/testkeys.conf;config/defaults/threads.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/ExchangeSimCfg.proto;config/protos/MarketData.proto;config/protos/Ports.proto;config/protos/Symbols.proto;config/protos/UI.proto;config/protos/cme_reference_data.proto;config/protos/jetfix.proto;config/protos/keycode.proto;config/protos/logging.proto;config/protos/mercury_cfg.proto;config/protos/orderman_cfg.proto;config/protos/orders_fills_cleanup.proto;config/protos/perflog_cfg.proto;config/protos/position_cfg.proto;config/protos/quickbus_cfg.proto;config/protos/span.proto;config/protos/spreader.proto;config/protos/subprocess.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/threads.proto;config/protos/toggles.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/sod.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/Diag/MDPeriodicDumper.cpp;md/Diag/ShmDumper.cpp;md/MBOProcessor.cpp;md/MBOServiceServer.cpp;md/MDClient.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MemorySegmentUtils.cpp;md/PlatformLoader.cpp;md/PriceSize.cpp;md/Product.cpp;md/SecurityCache.cpp;md/SecurityDB.cpp;md/SecurityIDRecorder.cpp;md/SecurityMapper.cpp;md/SecurityOracle.cpp;md/SettlementRecorder.cpp;md/Shm/FixedSecurity.cpp;md/SyntheticSecurityService.cpp;md/cme/MDP3Utils.cpp;md/common.cpp;md/ice/ICEUtils.cpp;md/protos/co2.proto;md/relay/QueryServer.cpp;md/relay/RelayClient.cpp;md/relay/RelayRecorder.cpp;md/service/MarketDataServiceServer.cpp;md/test/Co2ManagedTestHelper.cpp;md/test/Co2TestInstrument.cpp;md/test/mbo_tests.cpp;md/test/md2_tests.cpp;md/test/md_test_utils.cpp;md/test/synthetic_book_merge_tests.cpp;md/vendor/OnixsUtils.cpp;os/os.cpp;os/tests/os_tests.cpp;quickbus/core/LocalNode.cpp;quickbus/core/Quickbus.cpp;quickbus/core/SubscriptionID.cpp;quickbus/core/TableID.cpp;quickbus/message_model/Update.cpp;quickbus/message_model/merge_updates.cpp;quickbus/network/QBConnection.cpp;quickbus/network/QBConnectionManager.cpp;quickbus/network/endpoint_description.cpp;quickbus/network/quickbus_msgs.proto;quickbus/pubsub/TablePublisher.cpp;quickbus/pubsub/TableSubscriber.cpp;quickbus/pubsub/tests/qb_pubsub_tests.cpp;quickbus/routing/INode.cpp;quickbus/routing/NodeID.cpp;quickbus/routing/Router.cpp;quickbus/rpc/RPCClient.cpp;quickbus/rpc/RPCServer.cpp;quickbus/rpc/RPCSessionID.cpp;quickbus/rpc/rpc_utils.cpp;quickbus/rpc/tests/qb_rpc_tests.cpp;quickbus/tests/quickbus_tests.cpp;sparkproto/SparkProtos.proto;testing/catch_test_runner.cpp;utils/AuthSessionManager.cpp;utils/AuthToken.cLine truncated
|
||||
set(sources api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/service_helpers/AlgoServiceUtils.cpp;api/service_helpers/PositionUtilities.cpp;api/services/AdminService.proto;api/services/AlgoDefinitionService.proto;api/services/AlgoService.proto;api/services/ApiUnitTestService.proto;api/services/AuthService.proto;api/services/BasePositionService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MBOService.proto;api/services/MarginService.proto;api/services/MarketDataAuxiliaryService.proto;api/services/MarketDataRelay.proto;api/services/MoneyFileService.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/Symbols.conf;config/defaults/cme_reference_data.conf;config/defaults/edge.conf;config/defaults/jetfix.conf;config/defaults/keycode.conf;config/defaults/logging.conf;config/defaults/orderman_cfg.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/position_cfg.conf;config/defaults/span.conf;config/defaults/spreader.conf;config/defaults/testkeys.conf;config/defaults/threads.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/ExchangeSimCfg.proto;config/protos/MarketData.proto;config/protos/Ports.proto;config/protos/Symbols.proto;config/protos/UI.proto;config/protos/cme_reference_data.proto;config/protos/jetfix.proto;config/protos/keycode.proto;config/protos/logging.proto;config/protos/mercury_cfg.proto;config/protos/orderman_cfg.proto;config/protos/orders_fills_cleanup.proto;config/protos/perflog_cfg.proto;config/protos/position_cfg.proto;config/protos/quickbus_cfg.proto;config/protos/span.proto;config/protos/spreader.proto;config/protos/subprocess.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/threads.proto;config/protos/toggles.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/sod.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/Diag/MDPeriodicDumper.cpp;md/Diag/ShmDumper.cpp;md/MBOProcessor.cpp;md/MBOServiceServer.cpp;md/MDClient.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MemorySegmentUtils.cpp;md/PlatformLoader.cpp;md/PriceSize.cpp;md/SecurityCache.cpp;md/SecurityDB.cpp;md/SecurityIDRecorder.cpp;md/SecurityMapper.cpp;md/SecurityOracle.cpp;md/SettlementRecorder.cpp;md/Shm/FixedSecurity.cpp;md/SyntheticSecurityService.cpp;md/cme/MDP3Utils.cpp;md/common.cpp;md/ice/ICEUtils.cpp;md/protos/co2.proto;md/relay/QueryServer.cpp;md/relay/RelayClient.cpp;md/relay/RelayRecorder.cpp;md/test/Co2ManagedTestHelper.cpp;md/test/Co2TestInstrument.cpp;md/test/mbo_tests.cpp;md/test/md2_tests.cpp;md/test/md_test_utils.cpp;md/test/synthetic_book_merge_tests.cpp;md/vendor/OnixsUtils.cpp;os/os.cpp;os/tests/os_tests.cpp;quickbus/core/LocalNode.cpp;quickbus/core/Quickbus.cpp;quickbus/core/SubscriptionID.cpp;quickbus/core/TableID.cpp;quickbus/message_model/Update.cpp;quickbus/message_model/merge_updates.cpp;quickbus/network/QBConnection.cpp;quickbus/network/QBConnectionManager.cpp;quickbus/network/endpoint_description.cpp;quickbus/network/quickbus_msgs.proto;quickbus/pubsub/TablePublisher.cpp;quickbus/pubsub/TableSubscriber.cpp;quickbus/pubsub/tests/qb_pubsub_tests.cpp;quickbus/routing/INode.cpp;quickbus/routing/NodeID.cpp;quickbus/routing/Router.cpp;quickbus/rpc/RPCClient.cpp;quickbus/rpc/RPCServer.cpp;quickbus/rpc/RPCSessionID.cpp;quickbus/rpc/rpc_utils.cpp;quickbus/rpc/tests/qb_rpc_tests.cpp;quickbus/tests/quickbus_tests.cpp;sparkproto/SparkProtos.proto;testing/catch_test_runner.cpp;utils/AuthSessionManager.cpp;utils/AuthToken.cpp;utils/Dispatcher.cpp;utils/GrowableSPSCQueue.cpp;utils/HTTPStream.cpp;utils/PBUtils.cpp;Line truncated
|
||||
@@ -105,7 +105,7 @@ KeyModel = namedtuple("KeyModel", "type field")
|
||||
DefaultKeyModel = KeyModel("int", "id")
|
||||
def transform_service(service, keymap):
|
||||
return ServiceModel(
|
||||
service.name,
|
||||
service.name,
|
||||
option(service.options, apioptions_pb2.service_description, ""),
|
||||
[transform_method(m, keymap.get(m.output_type, DefaultKeyModel)) for m in service.method],
|
||||
service.name.lower())
|
||||
@@ -158,7 +158,7 @@ def to_type_model(field, msg):
|
||||
elif field.type == types.TYPE_DOUBLE: return TypeModel("double", islist, "double?", jstype='number')
|
||||
elif field.type == types.TYPE_FLOAT: return TypeModel("float", islist, "float?", jstype='number', fstype='float32')
|
||||
elif field.type == types.TYPE_STRING: return TypeModel("string", islist, cpptype="std::string")
|
||||
elif field.type == types.TYPE_BYTES: return TypeModel("ByteString", islist, cpptype="std::string", jstype='Uint8Array', fstype='Fable.Import.JS.Uint8Array')
|
||||
elif field.type == types.TYPE_BYTES: return TypeModel("ByteString", islist, cpptype="std::string", jstype='Uint8Array', fstype='uint8[]')
|
||||
elif field.type == types.TYPE_BOOL: return TypeModel("bool", islist, "bool?", jstype='boolean', natural_key=True)
|
||||
elif field.type == types.TYPE_ENUM:
|
||||
nested_enums = [x.name for x in msg.enum_type]
|
||||
@@ -185,8 +185,8 @@ def to_type_model(field, msg):
|
||||
map_value = to_type_model([f for f in t.field if f.name == 'value'][0], msg)
|
||||
itype = map_value.cstype+immutable_postfix
|
||||
return TypeModel(
|
||||
map_value.cstype,
|
||||
cpptype=map_value.cpptype,
|
||||
map_value.cstype,
|
||||
cpptype=map_value.cpptype,
|
||||
jstype=map_value.jstype,
|
||||
fstype=map_value.fstype,
|
||||
isMessage=True,
|
||||
@@ -234,7 +234,7 @@ def enum_short_name(enum_name, entry):
|
||||
return camel_case(entry[len(enum_name)+1:])
|
||||
return camel_case(entry)
|
||||
|
||||
def camel_case(item):
|
||||
def camel_case(item):
|
||||
if item.isupper() and not '_' in item: return item
|
||||
return item.title().replace('_', '')
|
||||
return d
|
||||
@@ -307,7 +307,7 @@ def generate_code(request, response):
|
||||
|
||||
#### MAIN #########
|
||||
if __name__ == "__main__":
|
||||
if DEBUG:
|
||||
if DEBUG:
|
||||
data = open("data", mode='rb').read()
|
||||
else:
|
||||
data = sys.stdin.read()
|
||||
@@ -317,7 +317,7 @@ if __name__ == "__main__":
|
||||
response = plugin.CodeGeneratorResponse()
|
||||
generate_code(request, response)
|
||||
|
||||
if DEBUG:
|
||||
if DEBUG:
|
||||
for f in response.file:
|
||||
print f.content
|
||||
else:
|
||||
|
||||
@@ -6,12 +6,12 @@ open google.protobuf
|
||||
|
||||
{{#each enum_type}}
|
||||
[<StringEnum>]
|
||||
type {{name}} =
|
||||
type {{name}} =
|
||||
{{#each values}}
|
||||
| [<CompiledName("{{name}}")>] {{short_name}}
|
||||
{{/each}}
|
||||
module {{name}} =
|
||||
let values =
|
||||
let values =
|
||||
[|
|
||||
{{#each values}}
|
||||
{{../name}}.{{short_name}}
|
||||
@@ -51,7 +51,7 @@ type {{name}} =
|
||||
module {{name}} =
|
||||
{{#each nested_enum}}
|
||||
[<StringEnum>]
|
||||
type {{name}} =
|
||||
type {{name}} =
|
||||
{{#each values}}
|
||||
| [<CompiledName("{{name}}")>] {{short_name}}
|
||||
{{/each}}
|
||||
@@ -95,7 +95,7 @@ module {{name}} =
|
||||
"{{name}}", {{@index}}., "{{output_type_full}}"
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
|]
|
||||
|]
|
||||
)
|
||||
|> unbox
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
syntax="proto3";
|
||||
package bts.api;
|
||||
option csharp_namespace="bts.api";
|
||||
option cc_enable_arenas=true;
|
||||
import "lib/api/apioptions.proto";
|
||||
import "lib/api/apicore.proto";
|
||||
import "lib/domain_model/Security.proto";
|
||||
import "lib/md/protos/co2.proto";
|
||||
|
||||
message ProductList {
|
||||
repeated bts.api.Product products = 1;
|
||||
}
|
||||
|
||||
// Should this cary int prices?
|
||||
message PriceEntry {
|
||||
double price = 1;
|
||||
uint32 direct = 10;
|
||||
uint32 implied = 11;
|
||||
}
|
||||
|
||||
message BookEntry {
|
||||
uint32 key = 1 [(bts.api.key)=true];
|
||||
repeated PriceEntry bid = 10;
|
||||
repeated PriceEntry ask = 20;
|
||||
}
|
||||
|
||||
message TickerEntry {
|
||||
uint32 key = 1 [(bts.api.key)=true];
|
||||
int64 time = 2;
|
||||
double price = 3;
|
||||
uint32 size = 4;
|
||||
uint32 total_volume = 5;
|
||||
bts.co2.AggressorSide aggressor_side = 6;
|
||||
bool from_spread = 7;
|
||||
bool gap = 10;
|
||||
}
|
||||
|
||||
|
||||
service MarketDataService {
|
||||
rpc get_products(bts.api.VoidMessage) returns (ProductList);
|
||||
// stream all securities
|
||||
rpc securities (bts.api.VoidMessage) returns (stream bts.api.Security);
|
||||
rpc book (bts.api.Product) returns (stream BookEntry);
|
||||
rpc trades(bts.api.VoidMessage) returns (stream TickerEntry);
|
||||
// subscribe_misc(Product)
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
#ifndef _WIN32
|
||||
#include "Product.h"
|
||||
|
||||
#include <boost/tokenizer.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace bts {
|
||||
namespace api {
|
||||
std::string product_to_string(const api::Product& p) {
|
||||
std::string buffer = p.symbol();
|
||||
buffer += ":";
|
||||
buffer += SecurityType_Name(p.type());
|
||||
buffer += ":";
|
||||
buffer += Venue_Name(p.exchange());
|
||||
return buffer;
|
||||
}
|
||||
std::optional<api::Product> string_to_product(const std::string& s) {
|
||||
boost::tokenizer<boost::char_separator<char>> tok { s };
|
||||
std::vector<std::string> parts;
|
||||
for (const auto& t : tok) {
|
||||
parts.push_back(t);
|
||||
}
|
||||
if (parts.size() != 3) return std::nullopt;
|
||||
SecurityType type = SecurityType::SECURITYTYPE_UNSET;
|
||||
if (!SecurityType_Parse(parts[1], &type)) return std::nullopt;
|
||||
Venue v = Venue::VENUE_UNSET;
|
||||
if (!Venue_Parse(parts[2], &v)) return std::nullopt;
|
||||
Product p;
|
||||
p.set_symbol(parts[0]);
|
||||
p.set_type(type);
|
||||
p.set_exchange(v);
|
||||
return {p};
|
||||
}
|
||||
|
||||
|
||||
}}//ns
|
||||
#endif
|
||||
@@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
#include "lib/domain_model/Security.pb.h"
|
||||
#include "lib/utils/optional.h"
|
||||
#include <string>
|
||||
|
||||
namespace bts {
|
||||
namespace api {
|
||||
|
||||
std::string product_to_string(const api::Product&);
|
||||
std::optional<api::Product> string_to_product(const std::string&);
|
||||
|
||||
|
||||
} }
|
||||
@@ -1,116 +0,0 @@
|
||||
#ifndef _WIN32
|
||||
#include "MarketDataServiceServer.h"
|
||||
#include "lib/metrics/metrics.h"
|
||||
#include "lib/md/UserSymbol.h"
|
||||
#include "lib/md/get_symbols.h"
|
||||
#include "lib/md/Product.h"
|
||||
#include "lib/utils/AuthToken.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <set>
|
||||
|
||||
|
||||
namespace bts {
|
||||
namespace md {
|
||||
|
||||
struct MarketDataServiceImpl {
|
||||
MarketDataServiceImpl(api::MarketDataServiceBase::SecuritiesStatefulPublisher);
|
||||
utils::Dispatcher& dispatcher;
|
||||
api::MarketDataServiceBase::SecuritiesStatefulPublisher security_publisher;
|
||||
std::atomic<uint32_t> sec_outstanding;
|
||||
void add_security(const SecurityPtr& sec) {
|
||||
++sec_outstanding;
|
||||
dispatcher.post([this,sec]() {
|
||||
security_publisher.add_or_update(*sec);
|
||||
auto flush = (--sec_outstanding) == 0;
|
||||
if (flush) {
|
||||
security_publisher.flush();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
MarketDataServiceImpl::MarketDataServiceImpl(
|
||||
api::MarketDataServiceBase::SecuritiesStatefulPublisher security_pub) :
|
||||
dispatcher(utils::Dispatcher::get_named("MDService")),
|
||||
security_publisher(security_pub),
|
||||
sec_outstanding(0)
|
||||
{
|
||||
}
|
||||
|
||||
MarketDataService::MarketDataService(
|
||||
MDClient& md,
|
||||
api::ServiceContext ctx,
|
||||
metrics::MetricsContainer&) :
|
||||
api::AuthenticatedMarketDataServiceBase(ctx)
|
||||
{
|
||||
_me = std::make_shared<MarketDataServiceImpl>(make_securities_stateful_publisher());
|
||||
md.current_consumer().on_security([me=_me](const SecurityPtr& sec, MDConsumerHandle) {
|
||||
me->add_security(sec);
|
||||
});
|
||||
}
|
||||
|
||||
// This method duplicates MarketDataRelayServer::request_products()
|
||||
void MarketDataService::get_products(
|
||||
const api::AuthToken&,
|
||||
const ::bts::api::VoidMessage&,
|
||||
const api::Response<::bts::api::ProductList>& reply) {
|
||||
|
||||
api::ProductList list;
|
||||
std::set<md::UserSymbol> syms;
|
||||
md::get_system_md_symbols(syms);
|
||||
for(const auto& i : syms) {
|
||||
auto prod = list.add_products();
|
||||
prod->set_exchange(i.exchange());
|
||||
prod->set_type(i.type());
|
||||
prod->set_symbol(i.symbol());
|
||||
}
|
||||
reply(list);
|
||||
}
|
||||
|
||||
api::StreamAccessResponse authorized(bool is_authorized) {
|
||||
api::StreamAccessResponse r;
|
||||
r.set_authorized(is_authorized);
|
||||
return r;
|
||||
}
|
||||
|
||||
void MarketDataService::allow_securities(
|
||||
const bts::api::AuthToken&,
|
||||
const std::string& qualifier,
|
||||
const api::Response<bts::api::StreamAccessResponse>& reply) {
|
||||
// Non-empty qualifier is invalid and rejected
|
||||
reply(authorized(qualifier.empty()));
|
||||
}
|
||||
|
||||
void MarketDataService::allow_book(
|
||||
const bts::api::AuthToken& token,
|
||||
const std::string& qualifier,
|
||||
const api::Response<bts::api::StreamAccessResponse>& reply) {
|
||||
api::user::TokenPayload payload;
|
||||
if (api::auth::decode_token(token, &payload)) {
|
||||
auto product = api::string_to_product(qualifier);
|
||||
if (product) {
|
||||
// todo: start streaming
|
||||
reply(authorized(true));
|
||||
}
|
||||
}
|
||||
reply(authorized(false));
|
||||
}
|
||||
|
||||
void MarketDataService::allow_trades(
|
||||
const bts::api::AuthToken& token,
|
||||
const std::string& qualifier,
|
||||
const api::Response<bts::api::StreamAccessResponse>& reply) {
|
||||
api::user::TokenPayload payload;
|
||||
if (api::auth::decode_token(token, &payload)) {
|
||||
auto product = api::string_to_product(qualifier);
|
||||
if (product) {
|
||||
// todo: start streaming
|
||||
reply(authorized(true));
|
||||
}
|
||||
}
|
||||
reply(authorized(false));
|
||||
}
|
||||
|
||||
}} //namespace
|
||||
#endif
|
||||
@@ -1,43 +0,0 @@
|
||||
#pragma once
|
||||
#include "lib/utils/Dispatcher.h"
|
||||
#include "lib/api/public/ServiceContext.h"
|
||||
#include "lib/api/services/MarketDataService.server.pb.h"
|
||||
#include "lib/md/MDClient.h"
|
||||
#include <memory>
|
||||
|
||||
namespace bts {
|
||||
namespace metrics { class MetricsContainer; }
|
||||
namespace md {
|
||||
|
||||
struct MarketDataServiceImpl;
|
||||
|
||||
class MarketDataService : public api::AuthenticatedMarketDataServiceBase {
|
||||
std::shared_ptr<MarketDataServiceImpl> _me;
|
||||
public:
|
||||
MarketDataService(
|
||||
MDClient& md,
|
||||
api::ServiceContext ctx,
|
||||
metrics::MetricsContainer& stats);
|
||||
|
||||
void get_products(
|
||||
const api::AuthToken&,
|
||||
const ::bts::api::VoidMessage&,
|
||||
const api::Response<::bts::api::ProductList>&) override;
|
||||
|
||||
void allow_securities(
|
||||
const bts::api::AuthToken&,
|
||||
const std::string& qualifier,
|
||||
const api::Response<bts::api::StreamAccessResponse>& reply) override;
|
||||
|
||||
void allow_book(
|
||||
const bts::api::AuthToken& token,
|
||||
const std::string& qualifier,
|
||||
const api::Response<bts::api::StreamAccessResponse>& reply) override;
|
||||
|
||||
void allow_trades(
|
||||
const bts::api::AuthToken& token,
|
||||
const std::string& qualifier,
|
||||
const api::Response<bts::api::StreamAccessResponse>& reply) override;
|
||||
};
|
||||
|
||||
}} //namespace
|
||||
@@ -31,9 +31,9 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor {
|
||||
public:
|
||||
MDSource(md::MDConsumer &consumer, metrics::MetricsContainer &stats,
|
||||
trace::PerfLog &log)
|
||||
: _handles(), _pending_handles(), _status_subs(), _md_consumer(consumer),
|
||||
: _handles(), _status_subs(), _md_consumer(consumer),
|
||||
_book_update(), _ticker_update(), _status_update(),
|
||||
_perf_log(log), _stats(stats), _loop_timer(), _counter(0) {
|
||||
_perf_log(log), _stats(stats), _loop_timer() {
|
||||
|
||||
_trades_buffer.Reserve(1000);
|
||||
auto cme_channels = md::get_configured_cme_channels();
|
||||
@@ -169,47 +169,6 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor {
|
||||
// Publish stats
|
||||
auto stop = utils::TimeStamp::now();
|
||||
_loop_timer->observe((start - stop).nanoseconds());
|
||||
|
||||
_counter += 1;
|
||||
if (_counter % (2<<20) == 0) {
|
||||
// Invoke periodic work every 2M calls on on_poll
|
||||
// This is approximately 20-30 seconds
|
||||
do_periodic_work();
|
||||
}
|
||||
}
|
||||
|
||||
void do_periodic_work() {
|
||||
if (!_pending_handles.empty()) {
|
||||
for (auto iter = _pending_handles.begin(); iter != _pending_handles.end(); ++iter) {
|
||||
if (iter->handle->is_initialized()) {
|
||||
auto handle = *(iter->handle);
|
||||
LOG(OrderMan, Info, "Found md for {}. Pending handle removed.", handle.key());
|
||||
switch(iter->type) {
|
||||
case MDRequestType::BOOK:
|
||||
_handles.push_back({utils::TimeStamp(), handle,
|
||||
get_external_event_channel(handle.get_usersymbol()),
|
||||
std::make_unique<std::string>(securities::descriptor(
|
||||
handle.get_normalized_security()))});
|
||||
break;
|
||||
case MDRequestType::STATUS:
|
||||
for (auto& h : _status_subs) {
|
||||
// no need to reset status
|
||||
if (h.handle.key() == handle.key()) break;
|
||||
}
|
||||
_status_subs.push_back(
|
||||
StatusRecord{ handle, co2::TRADINGSTATUS_UNKNOWN });
|
||||
case MDRequestType::TICKER:
|
||||
// We aren't currently monitoring for pending ticker requests
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
_pending_handles.erase(
|
||||
std::remove_if(_pending_handles.begin(),
|
||||
_pending_handles.end(),
|
||||
[](const auto& h) { return h.handle->is_initialized(); }),
|
||||
_pending_handles.end());
|
||||
}
|
||||
}
|
||||
|
||||
void on_book_sub(SecurityKey sk,
|
||||
@@ -225,23 +184,14 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor {
|
||||
|
||||
LOG(OrderMan, Warn,
|
||||
"Starting to publish book updates for security key: {}", k);
|
||||
auto handle = _md_consumer.get_handle(k);
|
||||
|
||||
auto mhandle = _md_consumer.get_managed_handle(k);
|
||||
if (mhandle->is_initialized()) {
|
||||
auto handle = *mhandle;
|
||||
_handles.push_back({utils::TimeStamp(), handle,
|
||||
get_external_event_channel(handle.get_usersymbol()),
|
||||
std::make_unique<std::string>(securities::descriptor(
|
||||
handle.get_normalized_security()))});
|
||||
if (handle.is_synthetic())
|
||||
synthetic_count_metric.increment();
|
||||
}
|
||||
else {
|
||||
// A pending handle is a handle for security we are reasonbly sure exists
|
||||
// but we haven't yet found live market data for.
|
||||
LOG(OrderMan, Warn, "No market data for {}. Pending handle added.", k);
|
||||
_pending_handles.push_back({ mhandle, MDRequestType::BOOK });
|
||||
}
|
||||
_handles.push_back({utils::TimeStamp(), handle,
|
||||
get_external_event_channel(handle.get_usersymbol()),
|
||||
std::make_unique<std::string>(securities::descriptor(
|
||||
handle.get_normalized_security()))});
|
||||
if (handle.is_synthetic())
|
||||
synthetic_count_metric.increment();
|
||||
}
|
||||
|
||||
const char *get_external_event_channel(const md::UserSymbol &user_symbol) {
|
||||
@@ -255,7 +205,7 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor {
|
||||
metrics::CounterMetric<int> &channel_count_metric) {
|
||||
|
||||
auto user_symbol = _md_consumer.get_handle(sk.value()).get_usersymbol();
|
||||
for (auto &ch : _channels) {
|
||||
for (auto &ch : _channels)
|
||||
if (ch.user_symbol == user_symbol) {
|
||||
auto it =
|
||||
std::find_if(ch.securities.begin(), ch.securities.end(),
|
||||
@@ -272,7 +222,6 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor {
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// this is a channel we are not subscribed to
|
||||
channel_count_metric.increment();
|
||||
@@ -301,14 +250,8 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor {
|
||||
return;
|
||||
}
|
||||
}
|
||||
auto handle = _md_consumer.get_managed_handle(k);
|
||||
if (handle->is_initialized()) {
|
||||
_status_subs.push_back(StatusRecord{ *handle, co2::TRADINGSTATUS_UNKNOWN });
|
||||
}
|
||||
else {
|
||||
LOG(OrderMan, Warn, "No market data for {}. Pending handle added.", k);
|
||||
_pending_handles.push_back({ handle, MDRequestType::STATUS });
|
||||
}
|
||||
auto handle = _md_consumer.get_handle(k);
|
||||
_status_subs.push_back(StatusRecord{ handle, co2::TRADINGSTATUS_UNKNOWN });
|
||||
}
|
||||
|
||||
struct HandleRecord {
|
||||
@@ -318,11 +261,6 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor {
|
||||
std::unique_ptr<std::string> symbol;
|
||||
};
|
||||
boost::container::small_vector<HandleRecord, 100> _handles;
|
||||
struct PendingRecord {
|
||||
std::shared_ptr<md::MDConsumerHandle> handle;
|
||||
MDRequestType type;
|
||||
};
|
||||
boost::container::small_vector<PendingRecord, 4> _pending_handles;
|
||||
|
||||
struct ChannelRecord {
|
||||
int64_t cursor;
|
||||
@@ -347,7 +285,6 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor {
|
||||
metrics::MetricsContainer &_stats;
|
||||
std::shared_ptr<metrics::HistogramMetric<30>> _loop_timer;
|
||||
std::map<md::UserSymbol, std::string> _symbol_to_channel;
|
||||
uint64_t _counter;
|
||||
};
|
||||
} // namespace orderman
|
||||
} // namespace bts
|
||||
+6
-5
@@ -5,6 +5,7 @@ from bluetradingsystems/linux_docker
|
||||
# This lets us query an image to see when it was built
|
||||
ARG SDK_VERSION=0
|
||||
ARG SDK_BUILD_DATE=0
|
||||
ARG USERNAME=bts
|
||||
|
||||
# configure build_examples
|
||||
env SDK_ROOT=/sdk \
|
||||
@@ -12,14 +13,14 @@ env SDK_ROOT=/sdk \
|
||||
SDK_BUILD_DATE=$SDK_BUILD_DATE
|
||||
|
||||
# add user bts
|
||||
RUN groupadd --gid 1000 bts && \
|
||||
useradd -s /bin/bash --uid 1000 --gid 1000 -m bts && \
|
||||
RUN groupadd --gid 1000 $USERNAME && \
|
||||
useradd -s /bin/bash --uid 1000 --gid 1000 -m $USERNAME && \
|
||||
mkdir -p /sparkbin/plugins && \
|
||||
mkdir /sparkdata && \
|
||||
mkdir /sdk && \
|
||||
ln -s /sparkbin/ /sdk/lib && \
|
||||
echo bts ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/bts && \
|
||||
chmod 0440 /etc/sudoers.d/bts && \
|
||||
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && \
|
||||
chmod 0440 /etc/sudoers.d/$USERNAME && \
|
||||
chown -R bts.bts /sparkbin/plugins && \
|
||||
chown -R bts.bts /sparkdata
|
||||
|
||||
@@ -28,6 +29,6 @@ COPY include/ /sdk/include/
|
||||
COPY lib/ /sparkbin/
|
||||
COPY externals /sdk/externals/
|
||||
COPY spark.conf /sparkdata/conf/
|
||||
COPY --chown=bts futures.coconut /sparkdata/data/replay/futures.coconut
|
||||
COPY --chown=$USERNAME futures.coconut /sparkdata/data/replay/futures.coconut
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"name": "Spark sdk container",
|
||||
"image": "spark_sdk",
|
||||
"runArgs": [
|
||||
"--shm-size", "2048m",
|
||||
"--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined",
|
||||
"-u", "bts"
|
||||
],
|
||||
"settings": {
|
||||
"terminal.integrated.shell.linux": "/bin/bash",
|
||||
"C_Cpp.default.cppStandard": "c++20"
|
||||
},
|
||||
// use 9000 to avoid conflict with typical bts dev setup
|
||||
"appPort": [9000,9001],
|
||||
"postCreateCommand": "",
|
||||
"extensions": [
|
||||
"ms-vscode.cpptools"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
client_sdk_example
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceFolder}/**",
|
||||
"/sdk/include/",
|
||||
"/sdk/include/spark",
|
||||
"/sdk/externals/include"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/clang",
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++17",
|
||||
"intelliSenseMode": "clang-x64"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "(gdb) Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "/sparkbin/sparkd",
|
||||
"args": ["run"],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "/sparkbin",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
// variables: ${workspaceRoot}
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"type": "shell",
|
||||
"command": "./build.sh",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Start Sparkd",
|
||||
"type": "shell",
|
||||
"command": "cd /sparkbin; ./sparkd run",
|
||||
"isBackground": true,
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Stop Sparkd",
|
||||
"type": "shell",
|
||||
"command": "pkill -f sparkd"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SDK_ROOT=${SDK_ROOT:-../..}
|
||||
NAME=client_sdk_example
|
||||
|
||||
g++ -isystem $SDK_ROOT/externals/include \
|
||||
-I $SDK_ROOT/include \
|
||||
-I $SDK_ROOT/include/spark \
|
||||
-std=c++1z \
|
||||
-fPIC \
|
||||
-g \
|
||||
-o $NAME \
|
||||
$NAME.cpp \
|
||||
-Wl,-rpath,/sparkbin\
|
||||
-L $SDK_ROOT/lib \
|
||||
-l spark
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
#include "lib/api/public/ServiceContext.h"
|
||||
#include "spark/lib/domain_model/Security.h"
|
||||
#include "lib/api/services/AdminService.client.pb.h"
|
||||
#include "lib/api/services/PositionService.client.pb.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
|
||||
using namespace bts::api;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
ServiceContext ctx;
|
||||
auto admin_service = ctx.locate<admin::AdminService>();
|
||||
auto res = admin_service.get_admin_data({});
|
||||
if (res.success()) {
|
||||
std::cout << "Users:" << std::endl;
|
||||
const auto& data = *res.value();
|
||||
for (const auto& u : data.users()) {
|
||||
std::cout << u.id() << "\t" << u.name() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
auto position_service = ctx.locate<position::PositionService>();
|
||||
auto sub = position_service.subscribe_position_data().subscribe([](const auto& update) {
|
||||
std::cout << "Position:" << std::endl;
|
||||
std::cout << "Account\tSecurity\tday long\tday short";
|
||||
for (const auto& a : update.all()) {
|
||||
std::cout << a->account() << "\t" << a->security_id() << "\t" << a->day_long_pos() << "\t" << a->day_short_pos();
|
||||
}
|
||||
});
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::minutes(5));
|
||||
return 0;
|
||||
}
|
||||
@@ -23,6 +23,7 @@ Ports {
|
||||
value {
|
||||
config_port: 9000
|
||||
qbus_port: 9001
|
||||
exchange_sim_fix_port: 9002
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "lib/md/MDClient.h"
|
||||
#include "lib/md/SyntheticSecurityService.h"
|
||||
#include "lib/md/relay/QueryServer.h"
|
||||
#include "lib/md/service/MarketDataServiceServer.h"
|
||||
#include "lib/metrics/metrics.h"
|
||||
#include "lib/metrics/system_metrics.h"
|
||||
#include "lib/orderman/order_factory/DynamicOrderRegistry.h"
|
||||
@@ -84,7 +83,6 @@ int Run::execute(std::vector<std::string> const &) {
|
||||
|
||||
md::MBOServiceServer mboserver(sc, utils::Dispatcher::background(),
|
||||
mdclient);
|
||||
md::MarketDataService mdserver(mdclient, sc, stats);
|
||||
|
||||
// initialize order plugins
|
||||
orderman::DynamicOrderRegistry dyn_order_registry;
|
||||
|
||||
@@ -1 +1 @@
|
||||
set(sources ../../externals/linux/include/google/protobuf/descriptor.proto;../../externals/linux/include/google/protobuf/timestamp.proto;../lib/api/apicore.proto;../lib/api/apigateway.proto;../lib/api/apioptions.proto;../lib/api/services/AdminService.proto;../lib/api/services/AlgoDefinitionService.proto;../lib/api/services/AlgoService.proto;../lib/api/services/ApiUnitTestService.proto;../lib/api/services/AuthService.proto;../lib/api/services/BasePositionService.proto;../lib/api/services/ErrorReportService.proto;../lib/api/services/HelloService.proto;../lib/api/services/MBOService.proto;../lib/api/services/MarginService.proto;../lib/api/services/MarketDataAuxiliaryService.proto;../lib/api/services/MarketDataRelay.proto;../lib/api/services/MarketDataService.proto;../lib/api/services/MoneyFileService.proto;../lib/api/services/OrderService.proto;../lib/api/services/OutOfProcessURLListener.proto;../lib/api/services/PersistenceService.proto;../lib/api/services/PositionService.proto;../lib/api/services/ShellDiagnosticService.proto;../lib/api/services/ShellLatencyService.proto;../lib/api/services/SyntheticSecurityService.proto;../lib/domain_model/Security.proto;../lib/md/protos/co2.proto;../lib/sparkproto/SparkProtos.proto;api/build.sh;api/node_modules/exit/test/fixtures/create-files.sh;api/node_modules/object.assign/test.sh;api/node_modules/protobufjs/cli/node_modules/acorn-jsx/node_modules/acorn/bin/update_authors.sh;api/node_modules/watch/release.sh;api/quiet_build.sh;api/src/DynamicService.ts;api/src/ServiceContext.ts;api/src/bts_assert.ts;ui/src/Access.fs;ui/src/Accounts/ClipLimits.fs;ui/src/Accounts/ProductLimits.fs;ui/src/Accounts/SecurityLimits.fs;ui/src/Accounts/State.fs;ui/src/Accounts/Types.fs;ui/src/Accounts/View.fs;ui/src/App.fs;ui/src/Cmd.fs;ui/src/Controls/Button.fs;ui/src/Controls/DataGrid.fs;ui/src/Controls/Fields.fs;ui/src/Controls/Modal.fs;ui/src/Controls/ReactGrid.fs;ui/src/Controls/Table.fs;ui/src/Controls/nbsp.fs;ui/src/Global.fs;ui/src/Imports.fs;ui/src/Lens.fs;ui/src/Login/Login.fs;ui/src/Nav.fs;ui/src/State.fs;ui/src/Types.fs;ui/src/Users/State.fs;ui/src/Users/Types.fs;ui/src/Users/View.fs;ui/src/Util/EnumUtils.fs;ui/src/Util/JSMap.fs;ui/src/Util/StreamUtils.fs;ui/src/obj/Debug/netstandard2.0/ui.AssemblyInfo.fs)
|
||||
set(sources ../../externals/linux/include/google/protobuf/descriptor.proto;../../externals/linux/include/google/protobuf/timestamp.proto;../lib/api/apicore.proto;../lib/api/apigateway.proto;../lib/api/apioptions.proto;../lib/api/services/AdminService.proto;../lib/api/services/AlgoDefinitionService.proto;../lib/api/services/AlgoService.proto;../lib/api/services/ApiUnitTestService.proto;../lib/api/services/AuthService.proto;../lib/api/services/BasePositionService.proto;../lib/api/services/ErrorReportService.proto;../lib/api/services/HelloService.proto;../lib/api/services/MBOService.proto;../lib/api/services/MarginService.proto;../lib/api/services/MarketDataAuxiliaryService.proto;../lib/api/services/MarketDataRelay.proto;../lib/api/services/MoneyFileService.proto;../lib/api/services/OrderService.proto;../lib/api/services/OutOfProcessURLListener.proto;../lib/api/services/PersistenceService.proto;../lib/api/services/PositionService.proto;../lib/api/services/ShellDiagnosticService.proto;../lib/api/services/ShellLatencyService.proto;../lib/api/services/SyntheticSecurityService.proto;../lib/domain_model/Security.proto;../lib/md/protos/co2.proto;../lib/sparkproto/SparkProtos.proto;api/build.sh;api/node_modules/exit/test/fixtures/create-files.sh;api/node_modules/protobufjs/cli/node_modules/acorn-jsx/node_modules/acorn/bin/update_authors.sh;api/node_modules/watch/release.sh;api/quiet_build.sh;api/src/DynamicService.ts;api/src/ServiceContext.ts;api/src/bts_assert.ts;ui/src/Access.fs;ui/src/Accounts/ClipLimits.fs;ui/src/Accounts/ProductLimits.fs;ui/src/Accounts/SecurityLimits.fs;ui/src/Accounts/State.fs;ui/src/Accounts/Types.fs;ui/src/Accounts/View.fs;ui/src/App.fs;ui/src/Cmd.fs;ui/src/Controls/Button.fs;ui/src/Controls/DataGrid.fs;ui/src/Controls/Fields.fs;ui/src/Controls/Modal.fs;ui/src/Controls/ReactGrid.fs;ui/src/Controls/Table.fs;ui/src/Controls/nbsp.fs;ui/src/Global.fs;ui/src/Imports.fs;ui/src/Lens.fs;ui/src/Login/Login.fs;ui/src/Nav.fs;ui/src/State.fs;ui/src/Types.fs;ui/src/Users/State.fs;ui/src/Users/Types.fs;ui/src/Users/View.fs;ui/src/Util/EnumUtils.fs;ui/src/Util/JSMap.fs;ui/src/Util/StreamUtils.fs;ui/src/obj/Debug/netstandard2.0/ui.AssemblyInfo.fs)
|
||||
@@ -31,7 +31,7 @@ function gen_method(service:IService, method_id : number, request_type : string,
|
||||
assertValid(request_proto, r)
|
||||
const buffer = request_proto.encode(r).finish()
|
||||
const result = await service.context.call(service.name, service.qualifier, method_id, buffer)
|
||||
let temp = result_proto.decode(result)
|
||||
// let temp = result_proto.decode(result)
|
||||
// There is a built in library function do do this but it doesn't work recursively
|
||||
// https://github.com/dcodeIO/protobuf.js/issues/1041
|
||||
// result_proto.toObject(temp, { enums: String, default: true })
|
||||
|
||||
@@ -4,19 +4,19 @@ import { assert, assertValid } from 'bts_assert'
|
||||
function default_ws_uri() {
|
||||
if (typeof window == 'undefined') return 'ws://sparkvm:8000/'
|
||||
const loc = window.location
|
||||
if (loc.hostname === "localhost" && loc.port === '8000') {
|
||||
if (loc.hostname === "localhost" && loc.port === '8080') {
|
||||
return "ws://sparkvm:8000/"
|
||||
}
|
||||
let ws_uri = "ws:";
|
||||
if (loc.protocol === "https:") {
|
||||
ws_uri = "wss:";
|
||||
}
|
||||
}
|
||||
ws_uri += "//" + loc.host;
|
||||
ws_uri += loc.pathname + "/";
|
||||
return ws_uri;
|
||||
}
|
||||
|
||||
// Message types
|
||||
// Message types
|
||||
const GatewayLogin = root.lookupType("bts.api.gateway.GatewayLogin")
|
||||
const GatewayRequest = root.lookupType("bts.api.gateway.GatewayRequest")
|
||||
const GatewayResponse = root.lookupType("bts.api.gateway.GatewayResponse")
|
||||
@@ -105,7 +105,7 @@ class PrivateContext {
|
||||
// },3000);
|
||||
}
|
||||
onmessage(e){
|
||||
const raw_buffer = new Uint8Array(e.data)
|
||||
const raw_buffer = new Uint8Array(e.data)
|
||||
const response = GatewayResponse.decode(raw_buffer)
|
||||
if (response && response.callResult && response.callResult.length > 0) {
|
||||
const call_buffer = response.callResult
|
||||
@@ -176,7 +176,7 @@ export class ServiceContext {
|
||||
});
|
||||
}
|
||||
|
||||
subscribe(serviceType: string, serviceQualifier:string,
|
||||
subscribe(serviceType: string, serviceQualifier:string,
|
||||
methodId: number, methodName : string,
|
||||
streamQualifier : string, callback: (x:RawUpdate[])=>void) : number {
|
||||
// Send a subscription request to the server
|
||||
@@ -209,7 +209,7 @@ export class ServiceContext {
|
||||
unsubscribe(subscriptionId : number, serviceType : string, serviceQualifier : string) {
|
||||
let req = GatewayUnsubscribe.create({subscriptionId, serviceType, serviceQualifier});
|
||||
let message = GatewayRequest.create({
|
||||
unsubscribe: req
|
||||
unsubscribe: req
|
||||
});
|
||||
this.send(message);
|
||||
}
|
||||
@@ -239,10 +239,10 @@ export class ServiceContext {
|
||||
if (update.id && this.subscriptions) {
|
||||
const s = this.subscriptions[update.id];
|
||||
if (s) {
|
||||
console.log("on tick");
|
||||
console.log(update);
|
||||
// console.log("on tick");
|
||||
// console.log(update);
|
||||
assert(update.id == s.id);
|
||||
s.callback(update.updates);
|
||||
s.callback(update.updates);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,6 +108,8 @@ body {
|
||||
}
|
||||
|
||||
.is-launcher-sidebar-menu {
|
||||
position:relative;
|
||||
height:100vh;
|
||||
padding: 0;
|
||||
background: $primary;
|
||||
max-width: 7rem;
|
||||
@@ -123,6 +125,11 @@ body {
|
||||
}
|
||||
}
|
||||
|
||||
.logout-icon {
|
||||
position:absolute;
|
||||
bottom:0;
|
||||
}
|
||||
|
||||
.launcher-item {
|
||||
text-align:center;
|
||||
width:100%;
|
||||
@@ -376,3 +383,35 @@ body {
|
||||
.is-100-width {
|
||||
width: 100px
|
||||
}
|
||||
|
||||
.filter-card {
|
||||
position:absolute;
|
||||
top:10px;
|
||||
left:10px;
|
||||
width: 13em;
|
||||
|
||||
.delete {
|
||||
float:right;
|
||||
margin: -10px -10px 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.clear-background {
|
||||
background: inherit;
|
||||
}
|
||||
|
||||
.table-header .header-icon-hidden {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.table-header:hover .header-icon-hidden {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.yellow {
|
||||
color:yellow;
|
||||
}
|
||||
|
||||
.header-filter-icon {
|
||||
margin-left:.5ex;
|
||||
}
|
||||
@@ -123,13 +123,13 @@ let init (context:ServiceContext.ServiceContext) =
|
||||
this_username = context.username
|
||||
ShowLoading = false
|
||||
ManualFillData = {
|
||||
fills = { manualFill = (Array.empty: bts.api.position.ManualFill [])}
|
||||
newFills = list.Empty
|
||||
updatedFills = list.Empty
|
||||
deletedFills = { manualFill = (Array.empty: bts.api.position.ManualFill [])}
|
||||
tempSODFillData = emptyTempManualFill
|
||||
tempDayFillData = emptyTempManualFill
|
||||
}
|
||||
fills = { manualFill = (Array.empty: bts.api.position.ManualFill [])}
|
||||
newFills = list.Empty
|
||||
updatedFills = list.Empty
|
||||
deletedFills = { manualFill = (Array.empty: bts.api.position.ManualFill [])}
|
||||
tempSODFillData = emptyTempManualFill
|
||||
tempDayFillData = emptyTempManualFill
|
||||
}
|
||||
}, Access.getAdminData admin UpdateAdminData NoAdminData
|
||||
|
||||
let positionSub model dispatch =
|
||||
@@ -182,7 +182,6 @@ let selectSub (tab:Tab option) model =
|
||||
match model.unsub with
|
||||
| Some (unsub) -> unsub.Dispose()
|
||||
| None ->
|
||||
System.Console.WriteLine "...?"
|
||||
()
|
||||
Cmd.none
|
||||
|
||||
@@ -409,14 +408,13 @@ let update msg (model:Model) : Model * Cmd<Msg> =
|
||||
| SelectAccount account ->
|
||||
{ (clearSelection model) with previousScratch = model.scratch
|
||||
scratch = account
|
||||
ManualFillData = {
|
||||
fills = { manualFill = (Array.empty: bts.api.position.ManualFill [])}
|
||||
newFills = list.Empty
|
||||
updatedFills = list.Empty
|
||||
deletedFills = { manualFill = (Array.empty: bts.api.position.ManualFill [])}
|
||||
tempSODFillData = emptyTempManualFill
|
||||
tempDayFillData = emptyTempManualFill
|
||||
}
|
||||
ManualFillData = { fills = { manualFill = (Array.empty: bts.api.position.ManualFill [])}
|
||||
newFills = list.Empty
|
||||
updatedFills = list.Empty
|
||||
deletedFills = { manualFill = (Array.empty: bts.api.position.ManualFill [])}
|
||||
tempSODFillData = emptyTempManualFill
|
||||
tempDayFillData = emptyTempManualFill
|
||||
}
|
||||
marginScratch = emptyMargin
|
||||
}, selectSub None model
|
||||
| GetMarginData ->
|
||||
|
||||
@@ -287,12 +287,12 @@ let clipLimitsView model dispatch =
|
||||
isHeader = false
|
||||
colSpan = 5
|
||||
}
|
||||
TableControl.Cell (Fields.text
|
||||
TableControl.Cell (Fields.uncheckedUint32
|
||||
""
|
||||
(sprintf "%i" (match (List.tryHead model.SelectedClipLimits) with
|
||||
| Some r -> r.clipSize
|
||||
| None -> 0u
|
||||
))
|
||||
((match (List.tryHead model.SelectedClipLimits) with
|
||||
| Some r -> r.clipSize
|
||||
| None -> 0u
|
||||
))
|
||||
[ ]
|
||||
((fun value -> (value, (Array.ofList model.SelectedClipLimits))) >> ChangeMultipleClipLimits >> dispatch)
|
||||
)
|
||||
@@ -467,21 +467,21 @@ let productLimits model dispatch =
|
||||
isHeader = false
|
||||
colSpan = 5
|
||||
}
|
||||
TableControl.Cell (Fields.text
|
||||
TableControl.Cell (Fields.uncheckedUint32
|
||||
""
|
||||
(sprintf "%i" (match (List.tryHead model.SelectedPositionLimits) with
|
||||
| Some r -> r.longPositionLimit
|
||||
| None -> 0u
|
||||
))
|
||||
((match (List.tryHead model.SelectedPositionLimits) with
|
||||
| Some r -> r.longPositionLimit
|
||||
| None -> 0u
|
||||
))
|
||||
[ ]
|
||||
((fun value -> ("long", value, (Array.ofList model.SelectedPositionLimits))) >> ChangeMultipleProductLimits >> dispatch)
|
||||
)
|
||||
TableControl.Cell (Fields.text
|
||||
TableControl.Cell (Fields.uncheckedUint32
|
||||
""
|
||||
(sprintf "%i" (match (List.tryHead model.SelectedPositionLimits) with
|
||||
| Some r -> r.shortPositionLimit
|
||||
| None -> 0u
|
||||
))
|
||||
( (match (List.tryHead model.SelectedPositionLimits) with
|
||||
| Some r -> r.shortPositionLimit
|
||||
| None -> 0u
|
||||
))
|
||||
[ ]
|
||||
((fun value -> ("short", value, (Array.ofList model.SelectedPositionLimits))) >> ChangeMultipleProductLimits >> dispatch)
|
||||
)
|
||||
@@ -789,6 +789,7 @@ let venueToString (venue:bts.api.Venue) =
|
||||
| bts.api.Venue.CBOECFE -> "CBOECFE"
|
||||
| bts.api.Venue.GLBX -> "GLBX"
|
||||
| bts.api.Venue.ICE -> "ICE"
|
||||
| bts.api.Venue.SIMICE -> "SIMICE"
|
||||
|
||||
let exchange_display expirationNameList =
|
||||
let s = sprintf "%O" expirationNameList.product.exchange
|
||||
|
||||
@@ -34,6 +34,7 @@ let root model dispatch =
|
||||
match model.page with
|
||||
| UsersModel m -> Users.View.root m (UsersMsg>>dispatch) |> topLevel model.context model.page dispatch
|
||||
| AccountsModel m -> Accounts.View.root m (AccountsMsg>>dispatch) |> topLevel model.context model.page dispatch
|
||||
| ReportsModel m -> Reports.View.root m (ReportsMsg>>dispatch) |> topLevel model.context model.page dispatch
|
||||
|
||||
open Elmish.React
|
||||
open Elmish.Debug
|
||||
@@ -42,8 +43,8 @@ open Elmish.HMR
|
||||
// App
|
||||
Program.mkProgram init update root
|
||||
#if DEBUG
|
||||
|> Program.withConsoleTrace
|
||||
|> Program.withDebugger
|
||||
//|> Program.withConsoleTrace
|
||||
//|> Program.withDebugger
|
||||
|> Program.withHMR
|
||||
#endif
|
||||
|> Program.withReactUnoptimized "elmish-app"
|
||||
|
||||
@@ -31,7 +31,22 @@ let text (lbl:string) (dv:string) (attrs:IHTMLProp list) onchange =
|
||||
ClassName "input"
|
||||
Type "text"
|
||||
Value dv
|
||||
OnChange (fun ev -> !!ev.target?value |> onchange)
|
||||
OnChange (fun ev -> !!ev.target?value |> string |> onchange)
|
||||
] @ attrs)
|
||||
]
|
||||
]
|
||||
|
||||
let dvText (lbl:string) (dv:string) (attrs:IHTMLProp list) onchange =
|
||||
// floating point numbers require using DefaultValue instead of Value
|
||||
div [ ClassName "field" ]
|
||||
[
|
||||
Label lbl
|
||||
div [ ClassName "control" ]
|
||||
[ input ([
|
||||
ClassName "input"
|
||||
Type "text"
|
||||
DefaultValue dv
|
||||
OnChange (fun ev -> !!ev.target?value |> string |> onchange)
|
||||
] @ attrs)
|
||||
]
|
||||
]
|
||||
@@ -150,7 +165,7 @@ let password (lbl:string) (dv:string) (attrs:IHTMLProp list) onchange =
|
||||
] @ attrs)
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
|
||||
let number (lbl:string) (dv:string) (attrs:IHTMLProp list) (validate: string -> bool) onchange =
|
||||
let errorClass = match dv |> validate with
|
||||
@@ -180,17 +195,25 @@ let positiveIntNumber (lbl:string) (dv:string) (attrs:IHTMLProp list) onchange =
|
||||
let validate value =
|
||||
let itp = System.Int32.TryParse value
|
||||
fst itp && snd itp >= 0
|
||||
|
||||
number lbl dv attrs validate onchange
|
||||
|
||||
|
||||
|
||||
let number_novalidate (lbl:string) (dv) (attrs:IHTMLProp list) onchange =
|
||||
text lbl (string dv) attrs (unbox>>onchange)
|
||||
|
||||
let uncheckedInt (lbl:string) (dv:int) (attrs:IHTMLProp list) onchange =
|
||||
text lbl (string dv) attrs (int>>onchange)
|
||||
|
||||
let double (lbl:string) (dv:double) (attrs:IHTMLProp list) onchange =
|
||||
text lbl (string dv) attrs (double>>onchange)
|
||||
let uncheckedUint32 (lbl:string) (dv:uint32) (attrs:IHTMLProp list) onchange =
|
||||
text lbl (string dv) attrs (uint32>>onchange)
|
||||
|
||||
let uncheckedInt64 (lbl:string) (dv:int64) (attrs:IHTMLProp list) onchange =
|
||||
text lbl (string dv) attrs (int64>>onchange)
|
||||
|
||||
let uncheckedDouble (lbl:string) (dv:double) (attrs:IHTMLProp list) onchange =
|
||||
match dv with
|
||||
| System.Double.MinValue | System.Double.MaxValue ->
|
||||
dvText lbl "" attrs (double>>onchange)
|
||||
| _ ->
|
||||
dvText lbl (string dv) attrs (double>>onchange)
|
||||
|
||||
let enumSelect<'a> (lbl:string) (dv:'a) (values:'a[]) (attrs:IHTMLProp list) (onchange:'a->unit) =
|
||||
let vals = match (Array.tryFindIndex (fun elm -> unbox elm = unbox dv) values) with
|
||||
|
||||
@@ -109,4 +109,26 @@ let createSelectorTableWithStyle (headers:row option) (rl:row list) className st
|
||||
If a callback is provided add a checkbox as the first column and set a background color if it is checked... in addition to the callback
|
||||
*)
|
||||
|
||||
let createSelectorTable (headers:row option) (rl:row list) = createSelectorTableWithStyle headers rl "" []
|
||||
let createSelectorTable (headers:row option) (rl:row list) = createSelectorTableWithStyle headers rl "" []
|
||||
|
||||
let showFilter (content:ReactElement) (onApplyClick: MouseEvent -> Unit) (onClearClick: MouseEvent -> Unit) (onCloseClick: MouseEvent -> Unit) top left =
|
||||
div [][
|
||||
div [ Class "modal-background clear-background"; OnClick onCloseClick ][ ]
|
||||
div [ Class "card filter-card"; Style [ Top top; Left left ] ]
|
||||
[ div [ Class "card-content" ]
|
||||
[ content
|
||||
]
|
||||
footer [ Class "card-footer" ]
|
||||
[ p [ Class "card-footer-item"; OnClick onApplyClick ]
|
||||
[ span [ ]
|
||||
[ a [ ]
|
||||
[ str "Apply" ] ] ]
|
||||
p [ Class "card-footer-item"; OnClick onClearClick ]
|
||||
[ span [ ]
|
||||
[ a [ ]
|
||||
[ str "Clear" ] ] ] ] ]
|
||||
]
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
module Unsub
|
||||
open System
|
||||
open Fable.Helpers.React
|
||||
open Fable.Helpers.React.Props
|
||||
open Fable.Import.React
|
||||
|
||||
// This is kind of a hack...
|
||||
// Use the react lifecycle methods to implement a deterministric dispose of a subscription
|
||||
type Unsubscribe(props) =
|
||||
inherit Component<IDisposable,unit>(props)
|
||||
override this.componentWillUnmount() =
|
||||
printfn "Disposing subscription"
|
||||
this.props.Dispose()
|
||||
override this.render() =
|
||||
null
|
||||
|
||||
let unsub props =
|
||||
ofType<Unsubscribe,IDisposable,unit> props []
|
||||
+10
-3
@@ -24,6 +24,7 @@ let isCurrentPage page currentPage =
|
||||
match page, currentPage with
|
||||
| UsersModel _, UsersModel _ -> true
|
||||
| AccountsModel _, AccountsModel _ -> true
|
||||
| ReportsModel _, ReportsModel _ -> true
|
||||
| _ -> false
|
||||
|
||||
let navItem label icon state currentPage dispatch =
|
||||
@@ -48,16 +49,22 @@ let root (currentPage:Page) (sc:ServiceContext) dispatch =
|
||||
li [ Class "launcher-item" ]
|
||||
[ navItem "Accounts" "server" (tmap (Accounts.State.init sc) (AccountsModel,Cmd.map AccountsMsg)) currentPage dispatch ]
|
||||
li [ Class "launcher-item" ]
|
||||
[ navItem "Reports" "line-chart" (tmap (Reports.State.init sc) (ReportsModel,Cmd.map ReportsMsg)) currentPage dispatch ]
|
||||
li [ Class "launcher-item logout-icon" ]
|
||||
[ a [ Href "/" ]
|
||||
[ div [ ClassName "icon is-large" ] [
|
||||
i [ ClassName "fa fa-3x fa-sign-out" ] []
|
||||
i [ ClassName "fa fa-2x fa-sign-out" ] []
|
||||
]
|
||||
div [] [str ("Logout \n" + sc.username)]
|
||||
div [] [
|
||||
str "Logout"
|
||||
br []
|
||||
str sc.username
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
let (navRoot: Page -> ServiceContext -> Dispatch<Msg> -> ReactElement) =
|
||||
let (navRoot: Page -> ServiceContext -> Dispatch<Msg> -> ReactElement) =
|
||||
lazyView3With (fun b c -> isCurrentPage (fst b) (fst c)) root
|
||||
@@ -0,0 +1,691 @@
|
||||
module Reports.State
|
||||
|
||||
open Elmish
|
||||
open Types
|
||||
open JSMap
|
||||
open System
|
||||
open System.Runtime.InteropServices
|
||||
open Fable.Import
|
||||
open Fable.Core
|
||||
open Fable.Core.JsInterop
|
||||
open System.Xml
|
||||
open Fable.PowerPack.PromiseImpl
|
||||
open bts.api.admin
|
||||
open bts.api.position
|
||||
open bts.api.persistence
|
||||
open bts.co2
|
||||
open Global
|
||||
|
||||
let getLoggedInID model =
|
||||
match model.adminData with
|
||||
| Some adata -> (Array.find (fun (usr:BTSUser) -> usr.name = model.this_username) adata.users).id
|
||||
| None -> 0u
|
||||
|
||||
let venueToString (venue:bts.api.Venue) =
|
||||
match venue with
|
||||
| bts.api.Venue.UNSET -> "Unset"
|
||||
| bts.api.Venue.BTS -> "BTS"
|
||||
| bts.api.Venue.SIM -> "SIM"
|
||||
| bts.api.Venue.CBOE -> "CBOE"
|
||||
| bts.api.Venue.CBOECFE -> "CBOECFE"
|
||||
| bts.api.Venue.GLBX -> "GLBX"
|
||||
| bts.api.Venue.ICE -> "ICE"
|
||||
| bts.api.Venue.SIMICE -> "SIMICE"
|
||||
|
||||
let securityTypeToString (venue:bts.api.SecurityType) =
|
||||
match venue with
|
||||
| bts.api.SecurityType.UNSET -> "Unset"
|
||||
| bts.api.SecurityType.STOCK -> "Stock"
|
||||
| bts.api.SecurityType.OPTION -> "Option"
|
||||
| bts.api.SecurityType.FUTURE -> "Future"
|
||||
| bts.api.SecurityType.SPREAD -> "Spread"
|
||||
| bts.api.SecurityType.SYNTHETIC -> "Synthetic"
|
||||
|
||||
let getAdminData (admin:IAdminService) (token:string) =
|
||||
Cmd.ofPromise
|
||||
admin.get_filtered_admin_data ()
|
||||
UpdateAdminData
|
||||
(fun _ -> RpcResponse "Error getting admin data")
|
||||
|
||||
let getPersistenceData model =
|
||||
let nameSpace = sprintf "%i%s" (model |> getLoggedInID) model.persisenceBaseNamespace
|
||||
Cmd.ofPromise
|
||||
model.persistenceService.retrieve {ns = nameSpace ; key = [|"pnlColumns"; "pnlFilterValues"; "pnlSorting" |]}
|
||||
UpdatePersistenceData
|
||||
(fun _ -> RpcResponse "Error getting Persistence data")
|
||||
|
||||
let PnLSub model dispatch =
|
||||
match model.unsub with
|
||||
| Some (unsub) -> unsub.Dispose()
|
||||
| None -> ()
|
||||
let svc = model.positionService
|
||||
svc.subscribe_pnl_data "" (
|
||||
fun (subUpdate:StreamUtils.IUpdate<bts.api.position.PNLUnit>) ->
|
||||
match subUpdate.added |> isEmpty, subUpdate.changed |> isEmpty with
|
||||
| true, true -> ()
|
||||
| _, _ ->
|
||||
subUpdate.all
|
||||
|> JSMap.toArray
|
||||
|> Array.map snd
|
||||
|> SetPositionData
|
||||
|> dispatch
|
||||
)
|
||||
|
||||
|> SetUnsub
|
||||
|> dispatch
|
||||
|
||||
let selectSub (tab:Tab option) model =
|
||||
match tab, model.currentTab with
|
||||
| Some PnL, _ | None, PnL -> Cmd.ofSub (PnLSub model)
|
||||
// | _ ->
|
||||
// match model.unsub with
|
||||
// | Some (unsub) -> unsub.Dispose()
|
||||
// | None ->
|
||||
// ()
|
||||
// Cmd.none
|
||||
|
||||
let requestProducts (mdRelay:IMarketDataRelay) = promise {
|
||||
let! result = mdRelay.request_products()
|
||||
return UpdateProducts result.products
|
||||
}
|
||||
|
||||
let requestExpNames (mdRelay:IMarketDataRelay) = promise {
|
||||
let! result = mdRelay.request_names()
|
||||
return UpdateExpirationNames result.securities
|
||||
}
|
||||
|
||||
let encodeUint8 (source:Object) =
|
||||
[| for ch in (toJson source) -> (uint8 ch) |]
|
||||
|
||||
let inline decodeUint8<'a> (source:uint8 []) =
|
||||
[| for ch in (source) -> (char ch) |]
|
||||
|> String
|
||||
|> ofJson<'a>
|
||||
|
||||
let saveSettings (persServ:IPersistenceService) (model:Model) = promise {
|
||||
let! result = persServ.store
|
||||
{ ns = sprintf "%i%s" (getLoggedInID model) model.persisenceBaseNamespace
|
||||
record = [|
|
||||
{ key = "pnlColumns"
|
||||
value = (model.PnLColumns |> encodeUint8) }
|
||||
{ key = "pnlFilterValues"
|
||||
value = (model.PnLFilterValues |> encodeUint8) }
|
||||
{ key = "pnlSorting"
|
||||
value = (model.PnLSortDirection |> encodeUint8) }
|
||||
|]
|
||||
}
|
||||
match result.result with
|
||||
| StoreResponse.Result.OK ->
|
||||
return PersistenceUpdateSuccess result
|
||||
| _ ->
|
||||
return ErrorOccured (sprintf "Error saving settings" )
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
let defaultPnLColumns = [
|
||||
("Account", true)
|
||||
("Symbol", false)
|
||||
("Exchange", false)
|
||||
("Type", true)
|
||||
("Security", true)
|
||||
("Security Key", false)
|
||||
("Total PnL", false)
|
||||
("Open PnL", false)
|
||||
("Day PnL", true)
|
||||
("Total Pos", false)
|
||||
("Total Long", false)
|
||||
("Total Long Avg", false)
|
||||
("Total Short", false)
|
||||
("Total Short Avg", false)
|
||||
("Open Pos", false)
|
||||
("Open Long", false)
|
||||
("Open Long Avg", false)
|
||||
("Open Short", false)
|
||||
("Open Short Avg", false)
|
||||
("Day Pos", true)
|
||||
("Day Long", false)
|
||||
("Day Long Avg", false)
|
||||
("Day Short", false)
|
||||
("Day Short Avg", false)
|
||||
("Raw Day Long", false)
|
||||
("Raw Day Short", false)
|
||||
("Raw Day Pos", false)
|
||||
("Traded Today", true)
|
||||
("Bid", false)
|
||||
("Ask", false)
|
||||
("Mid", false)
|
||||
("Last", false)
|
||||
("Settlement", false)
|
||||
("CPP", false)]
|
||||
|
||||
let getSec (securityList:Map<uint32, PositionSecurity>) ndx =
|
||||
match securityList.Count with
|
||||
| 0 -> {
|
||||
securityName = ""
|
||||
venue = bts.api.Venue.UNSET
|
||||
symbol = ""
|
||||
securityType = bts.api.SecurityType.UNSET
|
||||
}
|
||||
| _ -> securityList.[ndx]
|
||||
|
||||
|
||||
let init (context:ServiceContext.ServiceContext) : Model * Cmd<Msg> =
|
||||
let admin = AdminService.Create context ""
|
||||
let posServ = PositionService.Create context ""
|
||||
let basePosServ = BasePositionService.Create context ""
|
||||
let persServ = PersistenceService.Create context "settings"
|
||||
let mdr = MarketDataRelay.Create context ""
|
||||
{
|
||||
currentTab = Tab.PnL
|
||||
admin = admin
|
||||
adminData = None
|
||||
positionData = [||]
|
||||
basePositionService = basePosServ
|
||||
positionService = posServ
|
||||
persistenceService = persServ
|
||||
persisenceBaseNamespace = "#admin_ui"
|
||||
unsub = None
|
||||
ConfirmModal = "", (Msg.SwitchTab Tab.PnL)
|
||||
token = context.token
|
||||
this_username = context.username
|
||||
mdRelay = mdr
|
||||
mdRelayExpNameData = Array.empty<ExpirationNameList>
|
||||
mdRelayProductData = [||]
|
||||
securityList = Map.empty
|
||||
PnLColumns = defaultPnLColumns
|
||||
PnLSortFun = (fun (left:PNLUnit) (right:PNLUnit) -> (left.pos.securityId - right.pos.securityId) |> int)
|
||||
PnLSortDirection = "Security Key", true
|
||||
PnLFilter = Map.empty
|
||||
PnLFilterValues = Map.empty
|
||||
FilterOpen = false, Location (0.0,0.0)
|
||||
TempFilter = "", Empty
|
||||
GridSettingsOpen = false
|
||||
}, getAdminData admin context.token
|
||||
|
||||
let calcPnL (bid:double) (ask:double) (longPrice:double) (shortPrice:double) longPos shortPos (cashValue:double) =
|
||||
match bid, ask with
|
||||
| 0.0, _ | _,0.0 -> 0.0
|
||||
| _ ,_ ->
|
||||
let mid = (bid + ask) / 2.0
|
||||
let longDelta:double = mid - longPrice
|
||||
let shortDelta:double = shortPrice - mid
|
||||
|
||||
(
|
||||
(
|
||||
(longDelta * longPos)
|
||||
+ ( shortDelta * shortPos)
|
||||
)
|
||||
* cashValue
|
||||
)
|
||||
|
||||
let calcTotalPnL data =
|
||||
(calcPnL
|
||||
data.bidPrice
|
||||
data.askPrice
|
||||
data.pos.sod.longAvgPrice
|
||||
data.pos.sod.shortAvgPrice
|
||||
data.pos.sod.longPos
|
||||
data.pos.sod.shortPos
|
||||
data.cashValue)
|
||||
+ (calcPnL
|
||||
data.bidPrice
|
||||
data.askPrice
|
||||
data.pos.day.longAvgPrice
|
||||
data.pos.day.shortAvgPrice
|
||||
data.pos.day.longPos
|
||||
data.pos.day.shortPos
|
||||
data.cashValue)
|
||||
|
||||
let calcSODPnL data =
|
||||
(calcPnL
|
||||
data.bidPrice
|
||||
data.askPrice
|
||||
data.pos.sod.longAvgPrice
|
||||
data.pos.sod.shortAvgPrice
|
||||
data.pos.sod.longPos
|
||||
data.pos.sod.shortPos
|
||||
data.cashValue)
|
||||
|
||||
let calcDayPnL data =
|
||||
calcPnL
|
||||
data.bidPrice
|
||||
data.askPrice
|
||||
data.pos.day.longAvgPrice
|
||||
data.pos.day.shortAvgPrice
|
||||
data.pos.day.longPos
|
||||
data.pos.day.shortPos
|
||||
data.cashValue
|
||||
|
||||
let getPnLFilterType header =
|
||||
match header = "Symbol" || header = "Account"|| header = "Exchange" || header = "Type" || header = "Security" || header = "Traded Today" with
|
||||
| true -> StringSearch ""
|
||||
| false -> NumberRange (Double.MinValue, Double.MaxValue)
|
||||
|
||||
let getValFromPNLUnit header (data:PNLUnit) (securityList: Map<uint32, PositionSecurity> option) =
|
||||
let sec = match securityList with
|
||||
| Some secL -> getSec <| secL <| uint32 data.pos.securityId
|
||||
| None -> { securityName = ""; venue = bts.api.Venue.UNSET; symbol = ""; securityType = bts.api.SecurityType.UNSET}
|
||||
|
||||
match header with
|
||||
| "Symbol" -> sec.symbol, 0.0
|
||||
| "Account" -> data.pos.account, 0.0
|
||||
| "Exchange" -> venueToString sec.venue, 0.0
|
||||
| "Type" -> securityTypeToString <| sec.securityType, 0.0
|
||||
| "Security" -> sec.securityName, 0.0
|
||||
| "Security Key" -> "", data.pos.securityId |> double
|
||||
| "Total PnL" -> "", calcTotalPnL data
|
||||
| "Open PnL" -> "", calcSODPnL data
|
||||
| "Day PnL" -> "", calcDayPnL data
|
||||
| "Total Pos" -> "", ((data.pos.day.longPos + data.pos.sod.longPos) - (data.pos.day.shortPos + data.pos.sod.shortPos))
|
||||
| "Total Long" -> "", (data.pos.day.longPos + data.pos.sod.longPos)
|
||||
| "Total Long Avg" -> "", ((data.pos.day.longAvgPrice + data.pos.sod.longAvgPrice) / 2.0 )
|
||||
| "Total Short" -> "", data.pos.day.shortPos + data.pos.sod.shortPos
|
||||
| "Total Short Avg" -> "", (data.pos.day.shortAvgPrice + data.pos.sod.shortAvgPrice) / 2.0
|
||||
| "Open Pos" -> "", data.pos.sod.longPos - data.pos.sod.shortPos
|
||||
| "Open Long" -> "", data.pos.sod.longPos
|
||||
| "Open Long Avg" -> "", data.pos.sod.longAvgPrice
|
||||
| "Open Short" -> "", data.pos.sod.shortPos
|
||||
| "Open Short Avg" -> "", data.pos.sod.shortAvgPrice
|
||||
| "Day Pos" -> "", data.pos.day.longPos - data.pos.day.shortPos
|
||||
| "Day Long" -> "", data.pos.day.longPos
|
||||
| "Day Long Avg" -> "", data.pos.day.longAvgPrice
|
||||
| "Day Short" -> "", data.pos.day.shortPos
|
||||
| "Day Short Avg" -> "", data.pos.day.shortAvgPrice
|
||||
| "Raw Day Long" -> "", data.pos.rawDay.longPos
|
||||
| "Raw Day Short" -> "", data.pos.rawDay.shortPos
|
||||
| "Raw Day Pos" -> "", data.pos.rawDay.longPos - data.pos.rawDay.shortPos
|
||||
| "Traded Today" -> (if (data.pos.day.longPos > 0.0) || (data.pos.day.shortPos > 0.0) then "yes" else "no"), 0.0
|
||||
| "Bid" -> "", data.bidPrice
|
||||
| "Ask" -> "", data.askPrice
|
||||
| "Mid" -> "", (data.askPrice + data.bidPrice) / 2.0
|
||||
| "Last" -> "", data.lastPrice
|
||||
| "Settlement" -> "", data.settlementPrice
|
||||
| "CPP" -> "", data.cashValue
|
||||
| _ -> "", 0.0
|
||||
|
||||
let filterIsDefault filter =
|
||||
match filter with
|
||||
| StringSearch s -> s = ""
|
||||
| NumberRange (min, max) -> min = Double.MinValue && max = Double.MaxValue
|
||||
| Empty -> true
|
||||
|
||||
let update msg (model:Reports.Types.Model) : Model * Cmd<Msg> =
|
||||
match msg with
|
||||
| UpdateAdminData adm ->
|
||||
let newModel =
|
||||
{ model with
|
||||
adminData = Some adm
|
||||
}
|
||||
|
||||
newModel, Cmd.batch [
|
||||
selectSub (Some PnL) model
|
||||
Cmd.ofExistingPromise (requestProducts model.mdRelay) id (box>>ErrorOccured)
|
||||
getPersistenceData newModel
|
||||
]
|
||||
| SaveSettings ->
|
||||
model, Cmd.ofExistingPromise (saveSettings model.persistenceService model) id (box>>ErrorOccured)
|
||||
|
||||
| PersistenceUpdateSuccess sr ->
|
||||
model, Cmd.Empty
|
||||
|
||||
| UpdatePersistenceData pd ->
|
||||
match pd.result with
|
||||
| RetrieveResponse.Result.OK ->
|
||||
let pnlCols = Array.tryFind (fun (v:bts.api.persistence.Record) -> v.key = "pnlColumns") pd.record
|
||||
let pnlFilterValues = Array.tryFind (fun (v:bts.api.persistence.Record) -> v.key = "pnlFilterValues") pd.record
|
||||
let pnlSorting = Array.tryFind (fun (v:bts.api.persistence.Record) -> v.key = "pnlSorting") pd.record
|
||||
|
||||
let newCols =
|
||||
match pnlCols with
|
||||
| None -> model.PnLColumns
|
||||
| Some record -> (decodeUint8<List<string * bool>> record.value)
|
||||
|
||||
let newFilterValues =
|
||||
match pnlFilterValues with
|
||||
| None -> model.PnLFilterValues
|
||||
| Some record -> (decodeUint8<Map<string, ColFilter>> record.value)
|
||||
|
||||
let newSorting =
|
||||
match pnlSorting with
|
||||
| None -> model.PnLSortDirection
|
||||
| Some record ->
|
||||
(decodeUint8<string * bool> record.value)
|
||||
|
||||
{ model with PnLColumns = newCols; PnLFilterValues = newFilterValues; PnLSortDirection = newSorting },
|
||||
Cmd.batch (
|
||||
(Cmd.ofMsg (SetPnLSort <| newSorting ))::[ for f in newFilterValues do yield Cmd.ofMsg (SetPnLFilter (f.Key, f.Value))])
|
||||
| _ ->
|
||||
model, Cmd.Empty
|
||||
| RpcResponse str ->
|
||||
printf "%s" str
|
||||
model, Cmd.Empty
|
||||
| SwitchTab tab ->
|
||||
match tab with
|
||||
| PnL ->
|
||||
{ model with currentTab = tab }, selectSub (Some PnL) model
|
||||
| ErrorOccured msg ->
|
||||
Global.alert Global.Error (string msg)
|
||||
model,Cmd.Empty
|
||||
| OpenConfirmModal (title, okMessage) ->
|
||||
{model with ConfirmModal = title, okMessage}, Cmd.Empty
|
||||
| SetUnsub u ->
|
||||
{model with unsub = Some u }, Cmd.Empty
|
||||
| SetPositionData data ->
|
||||
{ model with positionData = data }, Cmd.none
|
||||
| RequestExpirationNames ->
|
||||
model, Cmd.ofExistingPromise (requestExpNames model.mdRelay) id (box>>ErrorOccured)
|
||||
| UpdateExpirationNames (data:ExpirationNameList[]) ->
|
||||
let secs:(uint32 * PositionSecurity) list =
|
||||
data
|
||||
|> List.ofArray
|
||||
|> List.collect (fun i ->
|
||||
JSMap.toList i.names
|
||||
|> List.map (fun x ->
|
||||
(uint32 <| fst x),
|
||||
({ securityName = (snd x)
|
||||
venue = i.product.exchange
|
||||
symbol = i.product.symbol
|
||||
securityType = i.product.``type``
|
||||
}: PositionSecurity)
|
||||
)
|
||||
)
|
||||
|
||||
{ model with mdRelayExpNameData = data; securityList = secs |> Map.ofList },
|
||||
Cmd.batch (
|
||||
selectSub None model ::
|
||||
(Cmd.ofMsg (SetPnLSort <| model.PnLSortDirection ))::
|
||||
[ for f in model.PnLFilterValues do yield Cmd.ofMsg (SetPnLFilter (f.Key, f.Value))])
|
||||
| UpdateProducts data ->
|
||||
{ model with mdRelayProductData = data}, Cmd.ofExistingPromise (requestExpNames model.mdRelay) id (box>>ErrorOccured)
|
||||
| ChangePnLColumnVisibility (header, visibility) ->
|
||||
let newData = [ for colHead, colVis
|
||||
in model.PnLColumns do yield
|
||||
( match colHead = header with
|
||||
| false -> (colHead, colVis)
|
||||
| true -> (colHead, visibility)
|
||||
)]
|
||||
model, Cmd.ofMsg (SetPnLColumns <| newData)
|
||||
| SetPnLColumns data ->
|
||||
{ model with PnLColumns = data}, Cmd.ofMsg SaveSettings
|
||||
| ShowGridSettings data ->
|
||||
{model with GridSettingsOpen = data}, Cmd.Empty
|
||||
| SetPnLTempFilter (header, filter) ->
|
||||
let newFilter = match filter with
|
||||
| Empty ->
|
||||
match Map.tryFindKey (fun k _ -> (k = header)) model.PnLFilterValues with
|
||||
| None -> getPnLFilterType header
|
||||
| Some k -> model.PnLFilterValues.Item k
|
||||
| _ -> filter
|
||||
|
||||
{model with TempFilter = header, newFilter}, Cmd.Empty
|
||||
| ShowFilterBox (header, isOpen, loca) ->
|
||||
let newFilter = match Map.containsKey header model.PnLFilterValues with
|
||||
| false -> getPnLFilterType header
|
||||
| true -> model.PnLFilterValues.Item header
|
||||
|
||||
{model with FilterOpen = (isOpen, loca); TempFilter = (header, newFilter)}, Cmd.ofMsg (SetPnLTempFilter (header, newFilter))
|
||||
|
||||
| SetPnLFilter (header, filter) ->
|
||||
match filterIsDefault filter with
|
||||
| true ->
|
||||
let newFilterValues =
|
||||
match Map.containsKey header model.PnLFilterValues with
|
||||
| true -> (Map.remove header model.PnLFilterValues)
|
||||
| false -> model.PnLFilterValues
|
||||
|
||||
let newMap =
|
||||
match Map.containsKey header model.PnLFilter with
|
||||
| true -> Map.remove header model.PnLFilter
|
||||
| false -> model.PnLFilter
|
||||
|
||||
{ model with PnLFilter = newMap; PnLFilterValues = newFilterValues }, Cmd.batch [
|
||||
("", false, Wherever) |> ShowFilterBox |> Cmd.ofMsg
|
||||
Cmd.ofMsg SaveSettings
|
||||
]
|
||||
| false ->
|
||||
let newFilterValues =
|
||||
match Map.containsKey header model.PnLFilterValues with
|
||||
| true -> (Map.remove header model.PnLFilterValues).Add(header, filter)
|
||||
| false -> model.PnLFilterValues.Add(header, filter)
|
||||
|
||||
let newFilter =
|
||||
match filter with
|
||||
| StringSearch s ->
|
||||
function pnl ->
|
||||
let v = (getValFromPNLUnit header pnl (Some model.securityList)) |> fst
|
||||
if s.Trim() = "" || v.ToLower().Contains (s.Trim().ToLower()) then Some pnl else None
|
||||
| NumberRange (min, max) ->
|
||||
function pnl ->
|
||||
let curVal = (getValFromPNLUnit header pnl None) |> snd
|
||||
if (min <= curVal && curVal <= max) then Some pnl else None
|
||||
| Empty -> Some
|
||||
|
||||
let newMap = model.PnLFilter.Add (header, newFilter)
|
||||
|
||||
{ model with PnLFilter = newMap; PnLFilterValues = newFilterValues }, Cmd.batch [
|
||||
("", false, Wherever) |> ShowFilterBox |> Cmd.ofMsg
|
||||
Cmd.ofMsg SaveSettings
|
||||
]
|
||||
|
||||
| ClearPnLFilter header ->
|
||||
match Map.containsKey header model.PnLFilterValues with
|
||||
| true -> model, Cmd.ofMsg (SetPnLFilter (header, Empty))
|
||||
| false -> model, Cmd.Empty
|
||||
|
||||
| SwitchPnLSort header ->
|
||||
let direction = fst <| model.PnLSortDirection <> header || not <| snd model.PnLSortDirection
|
||||
model, Cmd.ofMsg <| SetPnLSort (header, direction)
|
||||
| SetPnLSort (header, direction) ->
|
||||
let gSec = getSec <| model.securityList << uint32
|
||||
|
||||
let compStr (str1, str2) =
|
||||
match direction with
|
||||
| true -> String.Compare (str1, str2)
|
||||
| false -> String.Compare (str2, str1)
|
||||
|
||||
let compNum (num1:double) num2 =
|
||||
match direction with
|
||||
| true -> num1 - num2
|
||||
| false -> num2 - num1
|
||||
|
||||
let sortFn = match header with
|
||||
| "Symbol" -> (fun (left:PNLUnit) (right:PNLUnit) -> compStr (
|
||||
(gSec left.pos.securityId).symbol,
|
||||
(gSec right.pos.securityId).symbol
|
||||
)
|
||||
)
|
||||
| "Account" -> (fun (left:PNLUnit) (right:PNLUnit) -> compStr(left.pos.account, right.pos.account )
|
||||
)
|
||||
| "Exchange" -> (fun (left:PNLUnit) (right:PNLUnit) -> compStr (
|
||||
(venueToString (gSec left.pos.securityId).venue),
|
||||
(venueToString (gSec right.pos.securityId).venue)
|
||||
)
|
||||
)
|
||||
| "Type" -> (fun (left:PNLUnit) (right:PNLUnit) -> compStr (
|
||||
(securityTypeToString <| (gSec left.pos.securityId).securityType),
|
||||
(securityTypeToString <| (gSec right.pos.securityId).securityType)
|
||||
)
|
||||
)
|
||||
| "Security" -> (fun (left:PNLUnit) (right:PNLUnit) -> compStr (
|
||||
(gSec left.pos.securityId).securityName,
|
||||
(gSec right.pos.securityId).securityName
|
||||
)
|
||||
)
|
||||
| "Security Key" -> (fun (left:PNLUnit) (right:PNLUnit) ->
|
||||
match direction with
|
||||
| true -> left.pos.securityId - right.pos.securityId
|
||||
| false -> right.pos.securityId - left.pos.securityId
|
||||
|> int)
|
||||
| "Total PnL" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) ->
|
||||
let liSod = ((calcPnL
|
||||
left.bidPrice
|
||||
left.askPrice
|
||||
left.pos.sod.longAvgPrice
|
||||
left.pos.sod.shortAvgPrice
|
||||
left.pos.sod.longPos
|
||||
left.pos.sod.shortPos
|
||||
left.cashValue))
|
||||
let liDay = (calcPnL
|
||||
left.bidPrice
|
||||
left.askPrice
|
||||
left.pos.day.longAvgPrice
|
||||
left.pos.day.shortAvgPrice
|
||||
left.pos.day.longPos
|
||||
left.pos.day.shortPos
|
||||
left.cashValue)
|
||||
|
||||
let riSod = (calcPnL
|
||||
right.bidPrice
|
||||
right.askPrice
|
||||
right.pos.sod.longAvgPrice
|
||||
right.pos.sod.shortAvgPrice
|
||||
right.pos.sod.longPos
|
||||
right.pos.sod.shortPos
|
||||
right.cashValue)
|
||||
let riDay = (calcPnL
|
||||
right.bidPrice
|
||||
right.askPrice
|
||||
right.pos.day.longAvgPrice
|
||||
right.pos.day.shortAvgPrice
|
||||
right.pos.day.longPos
|
||||
right.pos.day.shortPos
|
||||
right.cashValue)
|
||||
|
||||
(compNum (liSod + liDay) (riSod + riDay)) * 1000.0 |> int
|
||||
|
||||
)//Total PNL
|
||||
| "Open PnL" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) ->
|
||||
let li = calcPnL
|
||||
left.bidPrice
|
||||
left.askPrice
|
||||
left.pos.sod.longAvgPrice
|
||||
left.pos.sod.shortAvgPrice
|
||||
left.pos.sod.longPos
|
||||
left.pos.sod.shortPos
|
||||
left.cashValue
|
||||
let ri = calcPnL
|
||||
right.bidPrice
|
||||
right.askPrice
|
||||
right.pos.sod.longAvgPrice
|
||||
right.pos.sod.shortAvgPrice
|
||||
right.pos.sod.longPos
|
||||
right.pos.sod.shortPos
|
||||
right.cashValue
|
||||
(compNum li ri) * 1000.0 |> int
|
||||
)// SOD Pnl (Open PnL)
|
||||
| "Day PnL" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) ->
|
||||
let li = calcPnL
|
||||
left.bidPrice
|
||||
left.askPrice
|
||||
left.pos.day.longAvgPrice
|
||||
left.pos.day.shortAvgPrice
|
||||
left.pos.day.longPos
|
||||
left.pos.day.shortPos
|
||||
left.cashValue
|
||||
|
||||
let ri = calcPnL
|
||||
right.bidPrice
|
||||
right.askPrice
|
||||
right.pos.day.longAvgPrice
|
||||
right.pos.day.shortAvgPrice
|
||||
right.pos.day.longPos
|
||||
right.pos.day.shortPos
|
||||
right.cashValue
|
||||
(compNum li ri) * 1000.0 |> int
|
||||
)//Day PnL
|
||||
| "Total Pos" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum ((left.pos.day.longPos + left.pos.sod.longPos) - (left.pos.day.shortPos + left.pos.sod.shortPos))
|
||||
((right.pos.day.longPos + right.pos.sod.longPos) - (right.pos.day.shortPos + right.pos.sod.shortPos))) * 1000.0 |> int
|
||||
)
|
||||
| "Total Long" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum (left.pos.day.longPos + left.pos.sod.longPos)
|
||||
(right.pos.day.longPos + right.pos.sod.longPos)) * 1000.0 |> int
|
||||
)//Total Long
|
||||
| "Total Long Avg" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum(left.pos.day.longAvgPrice + left.pos.sod.longAvgPrice)
|
||||
(right.pos.day.longAvgPrice + right.pos.sod.longAvgPrice)
|
||||
) * 1000.0 |> int
|
||||
)//Total Long Avg
|
||||
| "Total Short" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> ( compNum
|
||||
(left.pos.day.shortPos + left.pos.sod.shortPos)
|
||||
(right.pos.day.shortPos + right.pos.sod.shortPos)
|
||||
) * 1000.0 |> int
|
||||
)//Total Short
|
||||
| "Total Short Avg" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> ( compNum
|
||||
(left.pos.day.shortAvgPrice + left.pos.sod.shortAvgPrice)
|
||||
(right.pos.day.shortAvgPrice + right.pos.sod.shortAvgPrice)
|
||||
) * 1000.0 |> int)//Total Short Avg
|
||||
| "Open Pos" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> ( compNum
|
||||
(left.pos.sod.longPos - left.pos.sod.shortPos)
|
||||
(right.pos.sod.longPos - right.pos.sod.shortPos)
|
||||
) * 1000.0 |> int
|
||||
) // SOD Net Pos
|
||||
| "Open Long" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum
|
||||
left.pos.sod.longPos
|
||||
right.pos.sod.longPos
|
||||
) * 1000.0 |> int
|
||||
) // SOD Long Pos
|
||||
| "Open Long Avg" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum left.pos.sod.longAvgPrice right.pos.sod.longAvgPrice) * 1000.0 |> int ) //SOD Long Avg Price
|
||||
| "Open Short" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum left.pos.sod.shortPos right.pos.sod.shortPos) * 1000.0 |> int ) //SOD Short Pos
|
||||
| "Open Short Avg" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum left.pos.sod.shortAvgPrice right.pos.sod.shortAvgPrice) * 1000.0 |> int) //SOD Short Avg Price
|
||||
| "Day Pos" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> ( compNum
|
||||
(left.pos.day.longPos - left.pos.day.shortPos)
|
||||
(right.pos.day.longPos - right.pos.day.shortPos)
|
||||
) * 1000.0 |> int )//Day Pos
|
||||
| "Day Long" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum left.pos.day.longPos right.pos.day.longPos) * 1000.0 |> int)
|
||||
| "Day Long Avg" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum left.pos.day.longAvgPrice right.pos.day.longAvgPrice) * 1000.0 |> int)
|
||||
| "Day Short" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum left.pos.day.shortPos right.pos.day.shortPos) * 1000.0 |> int )
|
||||
| "Day Short Avg" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum left.pos.day.shortAvgPrice right.pos.day.shortAvgPrice) * 1000.0 |> int)
|
||||
| "Raw Day Long" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum left.pos.rawDay.longPos right.pos.rawDay.longPos) * 1000.0 |> int )
|
||||
| "Raw Day Short" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum left.pos.rawDay.longPos right.pos.rawDay.longPos) * 1000.0 |> int )
|
||||
| "Raw Day Pos" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> ( compNum
|
||||
(left.pos.rawDay.longPos - left.pos.rawDay.shortPos)
|
||||
(right.pos.rawDay.longPos - right.pos.rawDay.shortPos)
|
||||
) * 1000.0 |> int)//Raw Day Pos
|
||||
| "Traded Today" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (
|
||||
let lefti = if ((left.pos.day.longPos > 0.0) || (left.pos.day.shortPos > 0.0)) then 1 else 0
|
||||
let righti = if ((right.pos.day.longPos > 0.0) || (right.pos.day.shortPos > 0.0)) then 1 else 0
|
||||
match direction with
|
||||
| true -> lefti - righti
|
||||
| false -> righti - lefti
|
||||
)
|
||||
)//Traded Today
|
||||
| "Bid" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum left.bidPrice right.bidPrice) * 1000.0 |> int )//bid
|
||||
| "Ask" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum left.askPrice right.askPrice) * 1000.0 |> int )//ask
|
||||
| "Mid" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> ( compNum
|
||||
((left.askPrice + left.bidPrice) / 2.0)
|
||||
((right.askPrice + right.bidPrice) / 2.0)
|
||||
) * 1000.0 |> int )//mid
|
||||
| "Last" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum left.lastPrice right.lastPrice) * 1000.0 |> int)//last
|
||||
| "Settlement" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum left.settlementPrice right.settlementPrice) * 1000.0 |> int )
|
||||
| "CPP" ->
|
||||
(fun (left:PNLUnit) (right:PNLUnit) -> (compNum left.cashValue right.cashValue) * 1000.0 |> int )// CPP/cash value
|
||||
| _ -> (fun (left:PNLUnit) (right:PNLUnit) -> 0)
|
||||
|
||||
{ model with PnLSortFun = sortFn; PnLSortDirection = header, direction }, Cmd.ofMsg SaveSettings
|
||||
@@ -0,0 +1,80 @@
|
||||
module Reports.Types
|
||||
open System
|
||||
open bts.api.admin
|
||||
open bts.api.position
|
||||
open bts.api.persistence
|
||||
open bts.api
|
||||
open bts.co2
|
||||
open JSMap
|
||||
|
||||
type Tab =
|
||||
| PnL
|
||||
|
||||
type ColFilter =
|
||||
| StringSearch of string
|
||||
| NumberRange of min:double * max:double
|
||||
| Empty
|
||||
|
||||
type PositionSecurity =
|
||||
{
|
||||
securityName: string
|
||||
venue: bts.api.Venue
|
||||
symbol: string
|
||||
securityType: bts.api.SecurityType
|
||||
}
|
||||
|
||||
type Location =
|
||||
| Location of double*double
|
||||
| Wherever
|
||||
|
||||
type Msg =
|
||||
| RpcResponse of string
|
||||
| UpdateAdminData of AdminData
|
||||
| SaveSettings
|
||||
| UpdatePersistenceData of RetrieveResponse
|
||||
| PersistenceUpdateSuccess of StoreResponse
|
||||
| SwitchTab of Tab
|
||||
| ErrorOccured of obj
|
||||
| OpenConfirmModal of string * Msg
|
||||
| SetUnsub of System.IDisposable
|
||||
| SetPositionData of PNLUnit []
|
||||
| RequestExpirationNames
|
||||
| UpdateExpirationNames of ExpirationNameList[]
|
||||
| UpdateProducts of Product[]
|
||||
| ChangePnLColumnVisibility of string * bool
|
||||
| SetPnLColumns of (string * bool) List
|
||||
| SwitchPnLSort of string
|
||||
| SetPnLSort of string * bool
|
||||
| SetPnLTempFilter of string * ColFilter
|
||||
| SetPnLFilter of string * ColFilter
|
||||
| ClearPnLFilter of string
|
||||
| ShowGridSettings of bool
|
||||
| ShowFilterBox of string * bool * Location
|
||||
|
||||
type Model = {
|
||||
currentTab:Tab
|
||||
admin : IAdminService
|
||||
adminData : AdminData option
|
||||
positionData : PNLUnit []
|
||||
basePositionService: IBasePositionService
|
||||
positionService: IPositionService
|
||||
persistenceService: IPersistenceService
|
||||
persisenceBaseNamespace: string
|
||||
mdRelay : IMarketDataRelay
|
||||
mdRelayProductData: Product[]
|
||||
mdRelayExpNameData: ExpirationNameList[]
|
||||
unsub : System.IDisposable option
|
||||
securityList : Map<uint32, PositionSecurity>
|
||||
PnLColumns: (string * bool) list
|
||||
PnLSortFun: PNLUnit -> PNLUnit -> int
|
||||
PnLSortDirection: string * bool
|
||||
PnLFilter: Map<string, PNLUnit -> PNLUnit option>
|
||||
PnLFilterValues: Map<string, ColFilter>
|
||||
GridSettingsOpen: bool
|
||||
FilterOpen: bool * Location
|
||||
TempFilter: string * ColFilter
|
||||
|
||||
ConfirmModal: string * Msg
|
||||
token: string
|
||||
this_username: string
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
module Reports.View
|
||||
|
||||
open Fable.Core
|
||||
open Fable.Core.JsInterop
|
||||
open Fable.Helpers.React
|
||||
open Fable.Helpers.React.Props
|
||||
open Fable.Core.DynamicExtensions
|
||||
open Elmish
|
||||
open Elmish.React
|
||||
open Fable.Import
|
||||
open Global.Reflection
|
||||
open Types
|
||||
open Reports
|
||||
open bts.api.admin
|
||||
open bts.api
|
||||
open bts.api.position
|
||||
open EnumUtils
|
||||
open Microsoft.FSharp.Collections;
|
||||
open State
|
||||
|
||||
let isActiveTab tab currentTab =
|
||||
let ia = "is-active"
|
||||
match tab, currentTab with
|
||||
| Tab.PnL, Tab.PnL -> ia
|
||||
// | _ -> ""
|
||||
|
||||
let PnLTabView (model:Model) (dispatch:Msg->Unit) =
|
||||
// Browser.window.localStorage.setItem("PnLVisibleCols", "some")
|
||||
// let thing = Browser.window.localStorage.getItem("thing")
|
||||
let settingsModal =
|
||||
match model.GridSettingsOpen with
|
||||
| false -> span [][]
|
||||
| true ->
|
||||
Modal.show
|
||||
"PnL Grid Settings"
|
||||
(div[][
|
||||
h3 [Class "is-size-3"][str "Columns"]
|
||||
div [][
|
||||
for header, visible
|
||||
in model.PnLColumns do yield (
|
||||
Fields.checkbox header "" visible [] (fun _ -> (header, not visible) |> ChangePnLColumnVisibility |> dispatch)
|
||||
)
|
||||
]
|
||||
])
|
||||
(Button.button "Close" "" "times" Button.Enabled (fun _ -> false |> ShowGridSettings |> dispatch))
|
||||
(fun _ -> false |> ShowGridSettings |> dispatch)
|
||||
|
||||
let filterBox =
|
||||
let filterHeader, filterType = model.TempFilter
|
||||
let filterIsOpen, whereItIs = model.FilterOpen
|
||||
|
||||
let where =
|
||||
match whereItIs with
|
||||
| Wherever -> 0.0,0.0
|
||||
| Location (x, y) -> (x, y)
|
||||
|
||||
match filterType, filterIsOpen with
|
||||
| _, false | Empty, _ -> span [][]
|
||||
| StringSearch searchStr, true ->
|
||||
TableControl.showFilter
|
||||
(div[Id "filterbox"][
|
||||
Fields.text "Search:" (searchStr) [] (fun v -> (filterHeader, StringSearch v) |> SetPnLTempFilter |> dispatch)
|
||||
])
|
||||
(fun _ -> (filterHeader, filterType) |> SetPnLFilter |> dispatch)
|
||||
(fun _ -> filterHeader |> ClearPnLFilter |> dispatch)
|
||||
(fun _ -> ("", false, Wherever) |> ShowFilterBox |> dispatch)
|
||||
(sprintf "%fpx" (where |> snd)) (sprintf "%fpx" (where |> fst))
|
||||
| NumberRange (min, max), true ->
|
||||
TableControl.showFilter
|
||||
(div[Id "filterbox"][
|
||||
Fields.uncheckedDouble "Min" min [] (fun dv -> (filterHeader, NumberRange (dv, max)) |> SetPnLTempFilter |> dispatch)
|
||||
Fields.uncheckedDouble "Max" max [] (fun dv -> (filterHeader, NumberRange (min, dv)) |> SetPnLTempFilter |> dispatch)
|
||||
])
|
||||
(fun _ -> (filterHeader, filterType) |> SetPnLFilter |> dispatch)
|
||||
(fun _ -> filterHeader |> ClearPnLFilter |> dispatch)
|
||||
(fun _ -> ("", false, Wherever) |> ShowFilterBox |> dispatch)
|
||||
(sprintf "%fpx" (where |> snd)) (sprintf "%fpx" (where |> fst))
|
||||
|
||||
let sortIcon header visible =
|
||||
match fst model.PnLSortDirection = header, snd model.PnLSortDirection with
|
||||
| true, true -> i [ ClassName (sprintf "fa fa-sort-up")] [ ]
|
||||
| true, false -> i [ ClassName (sprintf "fa fa-sort-down")] [ ]
|
||||
| _, _ -> i [ ClassName (sprintf "fa fa-sort header-icon-hidden")] [ ]
|
||||
|
||||
let filterIcon header =
|
||||
let classStr = match Map.containsKey header model.PnLFilterValues || (fst model.TempFilter) = header with
|
||||
| true -> "fa fa-filter header-filter-icon yellow"
|
||||
| false -> "fa fa-filter header-filter-icon header-icon-hidden"
|
||||
let mutable origin = Location (0.0, 0.0)
|
||||
i [
|
||||
ClassName (classStr)
|
||||
Ref (fun me ->
|
||||
if me <> null then
|
||||
let r = me.getBoundingClientRect()
|
||||
origin <- Location (r.left, r.top + me.clientHeight) )
|
||||
OnClick (fun _ -> (header, true, origin) |> ShowFilterBox |> dispatch)
|
||||
] []
|
||||
|
||||
let headerRow:TableControl.row =
|
||||
{
|
||||
cells =
|
||||
[ for header, visible in model.PnLColumns do
|
||||
if visible then
|
||||
yield ( TableControl.Cell
|
||||
( div [ ClassName "table-header" ] [
|
||||
span [ OnClick (fun _ -> header |> SwitchPnLSort |> dispatch)] [str <| sprintf "%s " header]
|
||||
sortIcon header visible
|
||||
filterIcon header
|
||||
])
|
||||
) ]
|
||||
className = ""
|
||||
header = None
|
||||
onClick = None
|
||||
}
|
||||
|
||||
let fmtNum number = sprintf "%.2f" number
|
||||
|
||||
let rgSpan (s:string) =
|
||||
match s, s.Substring (0, 1) with
|
||||
| _, "-" -> span [Style [Color "#C41212"; FontWeight "bold"]] [str s]
|
||||
| "0.00", _ -> span [] [str s]
|
||||
| _ -> span [Style [Color "#008000"; FontWeight "bold"]] [str s]
|
||||
|
||||
let bidAskSpan (s:string) =
|
||||
match s, s.Substring (0, 1) with
|
||||
| _, "-" -> span [Style [Color "#A00000"]] [str s]
|
||||
| "0.00", _ -> span [] [str s]
|
||||
| _ -> span [Style [Color "#167ED3"]] [str s]
|
||||
|
||||
let boolToYesNo yes =
|
||||
match yes with
|
||||
| true -> "Yes"
|
||||
| false -> "No"
|
||||
|
||||
let bind a b i =
|
||||
match a i with
|
||||
| Some i -> b i
|
||||
| None -> None
|
||||
|
||||
let uberfilter = if model.PnLFilter.Count > 0 then model.PnLFilter |> Map.toArray |> Array.map snd |> Array.reduce bind else Some
|
||||
let filteredPositionData = (model.positionData |> Array.choose uberfilter)
|
||||
let sortedPositionData = filteredPositionData |> Array.sortWith model.PnLSortFun
|
||||
|
||||
let rws:TableControl.row list =
|
||||
[
|
||||
for data in sortedPositionData do yield {
|
||||
cells =
|
||||
[ for header, visible in
|
||||
model.PnLColumns do
|
||||
if visible then yield
|
||||
(
|
||||
let sec = getSec <| model.securityList <| uint32 data.pos.securityId
|
||||
match header with
|
||||
| "Symbol" -> TableControl.Cell (str (sprintf "%s" sec.symbol))
|
||||
| "Account" -> TableControl.Cell (str data.pos.account)
|
||||
| "Exchange" -> TableControl.Cell (str (sprintf "%s" (venueToString sec.venue)))
|
||||
| "Type" -> TableControl.Cell (str (sprintf "%s" (securityTypeToString <| sec.securityType)))
|
||||
| "Security" -> TableControl.Cell (str (sprintf "%s" sec.securityName))
|
||||
| "Security Key" -> TableControl.Cell (str (sprintf "%i" data.pos.securityId))
|
||||
| "Total PnL" -> TableControl.Cell (rgSpan (fmtNum (calcTotalPnL data)))
|
||||
| "Open PnL" -> TableControl.Cell (rgSpan (fmtNum (calcSODPnL data)))
|
||||
| "Day PnL" -> TableControl.Cell (rgSpan (fmtNum (calcDayPnL data)))
|
||||
| "Total Pos" ->
|
||||
TableControl.Cell (bidAskSpan (fmtNum ((data.pos.day.longPos + data.pos.sod.longPos) - (data.pos.day.shortPos + data.pos.sod.shortPos))))//Total Pos
|
||||
| "Total Long" ->
|
||||
TableControl.Cell (str (fmtNum (data.pos.day.longPos + data.pos.sod.longPos)))//Total Long
|
||||
| "Total Long Avg" ->
|
||||
TableControl.Cell (str (fmtNum ((data.pos.day.longAvgPrice + data.pos.sod.longAvgPrice))))//Total Long Avg
|
||||
| "Total Short" ->
|
||||
TableControl.Cell (str (fmtNum (data.pos.day.shortPos + data.pos.sod.shortPos)))//Total Short
|
||||
| "Total Short Avg" ->
|
||||
TableControl.Cell (str (fmtNum ((data.pos.day.shortAvgPrice + data.pos.sod.shortAvgPrice))))//Total Short Avg
|
||||
| "Open Pos" ->
|
||||
TableControl.Cell (bidAskSpan (fmtNum (data.pos.sod.longPos - data.pos.sod.shortPos))) // SOD Net Pos
|
||||
| "Open Long" ->
|
||||
TableControl.Cell (str (fmtNum data.pos.sod.longPos)) // SOD Long Pos
|
||||
| "Open Long Avg" ->
|
||||
TableControl.Cell (str (fmtNum data.pos.sod.longAvgPrice)) //SOD Long Avg Price
|
||||
| "Open Short" ->
|
||||
TableControl.Cell (str (fmtNum data.pos.sod.shortPos)) //SOD Short Pos
|
||||
| "Open Short Avg" ->
|
||||
TableControl.Cell (str (fmtNum data.pos.sod.shortAvgPrice)) //SOD Short Avg Price
|
||||
| "Day Pos" ->
|
||||
TableControl.Cell (str (fmtNum (data.pos.day.longPos - data.pos.day.shortPos)))//Day Pos
|
||||
| "Day Long" ->
|
||||
TableControl.Cell (str (fmtNum data.pos.day.longPos))
|
||||
| "Day Long Avg" ->
|
||||
TableControl.Cell (str (fmtNum data.pos.day.longAvgPrice))
|
||||
| "Day Short" ->
|
||||
TableControl.Cell (str (fmtNum data.pos.day.shortPos))
|
||||
| "Day Short Avg" ->
|
||||
TableControl.Cell (str (fmtNum data.pos.day.shortAvgPrice))
|
||||
| "Raw Day Long" ->
|
||||
TableControl.Cell (str (fmtNum data.pos.rawDay.longPos))
|
||||
| "Raw Day Short" ->
|
||||
TableControl.Cell (str (fmtNum data.pos.rawDay.longPos))
|
||||
| "Raw Day Pos" ->
|
||||
TableControl.Cell (str (fmtNum (data.pos.rawDay.longPos - data.pos.rawDay.shortPos)))//Raw Day Pos
|
||||
| "Traded Today" ->
|
||||
TableControl.Cell (str (boolToYesNo ((data.pos.day.longPos > 0.0) || (data.pos.day.shortPos > 0.0)) )) //Traded Today
|
||||
| "Bid" ->
|
||||
TableControl.Cell (span [Style [Color "#167ED3"]] [str (fmtNum data.bidPrice)])//bid
|
||||
| "Ask" ->
|
||||
TableControl.Cell (span [Style [Color "#A00000"]] [str (fmtNum data.askPrice)])//ask
|
||||
| "Mid" ->
|
||||
TableControl.Cell (str (fmtNum ((data.askPrice + data.bidPrice) / 2.0)))//mid
|
||||
| "Last" ->
|
||||
TableControl.Cell (str (fmtNum data.lastPrice))//last
|
||||
| "Settlement" ->
|
||||
TableControl.Cell (str (fmtNum data.settlementPrice))
|
||||
| "CPP" ->
|
||||
TableControl.Cell (str (fmtNum data.cashValue))//CPP/cash value
|
||||
| _ -> TableControl.Cell (str "")
|
||||
)]
|
||||
className = ""
|
||||
header = None
|
||||
onClick = None
|
||||
}
|
||||
]
|
||||
|
||||
div [] [
|
||||
TableControl.createDataTable (Some headerRow) rws (Button.fabutton "Settings" "cog" "" Button.Enabled ((fun _ -> true |> ShowGridSettings |> dispatch)))
|
||||
settingsModal
|
||||
filterBox
|
||||
]
|
||||
|
||||
let PnLAreEqual (one:PNLUnit []) (two:PNLUnit []) =
|
||||
match one.Length = two.Length with
|
||||
| false -> false
|
||||
| true ->
|
||||
let mutable acc = true
|
||||
for i = 0 to (one.Length - 1) do
|
||||
acc <- acc
|
||||
&& (int <| one.[i].pos.dayLongPos) = (int <| two.[i].pos.dayLongPos)
|
||||
&& (int <| one.[i].pos.dayShortPos) = (int <| two.[i].pos.dayShortPos)
|
||||
&& (int <| one.[i].pos.sodLongPos) = (int <| two.[i].pos.sodLongPos)
|
||||
&& (int <| one.[i].pos.sodShortPos) = (int <| two.[i].pos.sodShortPos)
|
||||
&& (int <| one.[i].askPrice * 100.0) = (int <| two.[i].askPrice * 100.0)
|
||||
&& (int <| one.[i].bidPrice * 100.0) = (int <| two.[i].bidPrice * 100.0)
|
||||
acc
|
||||
|
||||
let lazyPnLView model dispatch =
|
||||
lazyView2With (fun a b ->
|
||||
//LanguagePrimitives.PhysicalEquality a.positionData b.positionData
|
||||
(PnLAreEqual a.positionData b.positionData)
|
||||
&& a.GridSettingsOpen = b.GridSettingsOpen
|
||||
&& a.PnLColumns = b.PnLColumns
|
||||
&& a.PnLSortDirection = b.PnLSortDirection
|
||||
&& a.FilterOpen = b.FilterOpen
|
||||
&& a.TempFilter = b.TempFilter
|
||||
)
|
||||
PnLTabView
|
||||
model dispatch
|
||||
|
||||
let tabContent (model:Model) (dispatch:Msg->Unit) =
|
||||
div [ ClassName "is-tab-content"] [
|
||||
// match model.currentTab with
|
||||
// | Tab.PnL -> PnLTabView model dispatch
|
||||
lazyPnLView model dispatch
|
||||
]
|
||||
|
||||
let root (model:Model) (dispatch:Msg->Unit) =
|
||||
(match model.adminData with
|
||||
| None -> div[][str "Loading data..."]
|
||||
| Some data ->
|
||||
div [ ] [
|
||||
match model.unsub with | Some d -> yield Unsub.unsub d | None -> ()
|
||||
yield div [ Class "column is-main-content" ] [
|
||||
div [ ClassName "tabs is-boxed" ] [
|
||||
ul [ ] [
|
||||
li [ ClassName (isActiveTab Tab.PnL model.currentTab) ] [
|
||||
a [ OnClick (fun _ -> dispatch (SwitchTab Tab.PnL)) ] [ str "PnL" ]
|
||||
]
|
||||
]
|
||||
]
|
||||
tabContent model dispatch
|
||||
]
|
||||
]
|
||||
)
|
||||
@@ -19,21 +19,24 @@ let updateLoggedIn msg model =
|
||||
| AccountsMsg msg, AccountsModel m ->
|
||||
let (acc, msg) = Accounts.State.update msg m
|
||||
{ model with page = AccountsModel acc }, Cmd.map AccountsMsg msg
|
||||
| ReportsMsg msg, ReportsModel m ->
|
||||
let (reps, reportsCmd) = Reports.State.update msg m
|
||||
{ model with page = ReportsModel reps }, Cmd.map ReportsMsg reportsCmd
|
||||
| Navigate (page,pcmd), _ ->
|
||||
{ model with page = page }, pcmd
|
||||
| _ -> model, Cmd.Empty
|
||||
|
||||
let update msg model =
|
||||
match model with
|
||||
| PreLogin p ->
|
||||
| PreLogin p ->
|
||||
match msg with
|
||||
| LoginMsg (Login.LoginSuccess ctx) ->
|
||||
let (lmodel, lmsg) = Users.State.init ctx
|
||||
LoggedIn { context = ctx; page = UsersModel lmodel }, Cmd.map UsersMsg lmsg
|
||||
| LoginMsg m' ->
|
||||
| LoginMsg m' ->
|
||||
let (lmodel, lmsg) = Login.update m' p
|
||||
PreLogin lmodel, Cmd.map LoginMsg lmsg
|
||||
| _ -> model, Cmd.Empty
|
||||
| LoggedIn m ->
|
||||
| LoggedIn m ->
|
||||
let lmodel, lmsg = updateLoggedIn msg m
|
||||
LoggedIn lmodel, lmsg
|
||||
@@ -7,12 +7,14 @@ open Imports
|
||||
type Page =
|
||||
| UsersModel of Users.Types.Model
|
||||
| AccountsModel of Accounts.Types.Model
|
||||
| ReportsModel of Reports.Types.Model
|
||||
|
||||
type Msg =
|
||||
| UsersMsg of Users.Types.Msg
|
||||
| LoginMsg of Login.Message
|
||||
| Navigate of Page*Elmish.Cmd<Msg>
|
||||
| AccountsMsg of Accounts.Types.Msg
|
||||
| ReportsMsg of Reports.Types.Msg
|
||||
|
||||
|
||||
type LoggedInModel = {
|
||||
|
||||
@@ -204,6 +204,9 @@ let applyUpdate (field:UserField) (user:BTSUser) =
|
||||
| CanCreate cr -> { user with canCreate = cr }
|
||||
| CMEOperatorID oid -> updateCMEExchangeUserData user { user.userData.exchangeUserData.cmeData with operatorId = oid }
|
||||
|
||||
| CMEATSOperatorID _ -> user
|
||||
| MaxOrderRatePerConnection _ -> user
|
||||
|
||||
| ICECompanyID oid -> updateICEExchangeUserData user { user.userData.exchangeUserData.iceData with companyId = oid }
|
||||
| ICEOperatorID oid -> updateICEExchangeUserData user { user.userData.exchangeUserData.iceData with operatorId = oid }
|
||||
| ICEAuthorizedTrader oid -> updateICEExchangeUserData user { user.userData.exchangeUserData.iceData with authorizedTrader = oid }
|
||||
|
||||
@@ -280,7 +280,7 @@ let orderRoutingTabView (model:Model) (dispatch:Msg->Unit) (readonly:bool) =
|
||||
br []
|
||||
h2 [Class "is-size-3"] [ str "ICE" ]
|
||||
div [] [
|
||||
Fields.number_novalidate "Company ID" iceData.companyId [ ] (ICECompanyID >> UpdateField >> dispatch)
|
||||
Fields.uncheckedInt "Company ID" iceData.companyId [ ] (ICECompanyID >> UpdateField >> dispatch)
|
||||
Fields.text "Operator ID" iceData.operatorId [ ] (ICEOperatorID >> UpdateField >> dispatch)
|
||||
Fields.text "Authorized Trader" iceData.authorizedTrader [ ] (ICEAuthorizedTrader >> UpdateField >> dispatch)
|
||||
Fields.text "Authorized Group" iceData.authorizedGroup [ ] (ICEAuthorizedGroup >> UpdateField >> dispatch)
|
||||
@@ -289,14 +289,14 @@ let orderRoutingTabView (model:Model) (dispatch:Msg->Unit) (readonly:bool) =
|
||||
|
||||
h2 [Class "is-size-4"] [ str "MIFID" ]
|
||||
div [Style [MarginLeft "2em"]] [
|
||||
Fields.number_novalidate "Client Id Code" iceData.mifidClientIdCode [ ] (MifidClientIdCode >> UpdateField >> dispatch)
|
||||
Fields.number_novalidate "Commodity Deriv Indicator" iceData.mifidCommodityDerivIndicator [ ] (MifidCommodityDerivIndicator >> UpdateField >> dispatch)
|
||||
Fields.number_novalidate "Direct Electronic Access" iceData.mifidDirectElectronicAccess [ ] (MifidDirectElectronicAccess >> UpdateField >> dispatch)
|
||||
Fields.number_novalidate "Execution Decision" iceData.mifidExecutionDecision [ ] (MifidExecutionDecision >> UpdateField >> dispatch)
|
||||
Fields.number_novalidate "Id" iceData.mifidId [ ] (MifidId >> UpdateField >> dispatch)
|
||||
Fields.number_novalidate "Investment Decision" iceData.mifidInvestmentDecision [ ] (MifidInvestmentDecision >> UpdateField >> dispatch)
|
||||
Fields.number_novalidate "Liquidity Provision" iceData.mifidLiquidityProvision [ ] (MifidLiquidityProvision >> UpdateField >> dispatch)
|
||||
Fields.number_novalidate "Trading Capacity" iceData.mifidTradingCapacity [ ] (MifidTradingCapacity >> UpdateField >> dispatch)
|
||||
Fields.uncheckedInt64 "Client Id Code" iceData.mifidClientIdCode [ ] (MifidClientIdCode >> UpdateField >> dispatch)
|
||||
Fields.uncheckedInt "Commodity Deriv Indicator" iceData.mifidCommodityDerivIndicator [ ] (MifidCommodityDerivIndicator >> UpdateField >> dispatch)
|
||||
Fields.uncheckedInt "Direct Electronic Access" iceData.mifidDirectElectronicAccess [ ] (MifidDirectElectronicAccess >> UpdateField >> dispatch)
|
||||
Fields.uncheckedInt64 "Execution Decision" iceData.mifidExecutionDecision [ ] (MifidExecutionDecision >> UpdateField >> dispatch)
|
||||
Fields.uncheckedInt64 "Id" iceData.mifidId [ ] (MifidId >> UpdateField >> dispatch)
|
||||
Fields.uncheckedInt64 "Investment Decision" iceData.mifidInvestmentDecision [ ] (MifidInvestmentDecision >> UpdateField >> dispatch)
|
||||
Fields.uncheckedInt "Liquidity Provision" iceData.mifidLiquidityProvision [ ] (MifidLiquidityProvision >> UpdateField >> dispatch)
|
||||
Fields.uncheckedInt "Trading Capacity" iceData.mifidTradingCapacity [ ] (MifidTradingCapacity >> UpdateField >> dispatch)
|
||||
]
|
||||
]
|
||||
br []
|
||||
|
||||
@@ -34,10 +34,12 @@
|
||||
<Compile Include="$(API)/fable/MarginService.fable.fs" />
|
||||
<Compile Include="$(API)/fable/co2.fable.fs" />
|
||||
<Compile Include="$(API)/fable/MarketDataRelay.fable.fs" />
|
||||
<Compile Include="$(API)/fable/PersistenceService.fable.fs" />
|
||||
<!-- Global to the app -->
|
||||
<Compile Include="Lens.fs" />
|
||||
<Compile Include="Global.fs" />
|
||||
<Compile Include="Cmd.fs" />
|
||||
<Compile Include="Controls/Unsub.fs" />
|
||||
<Compile Include="Controls/nbsp.fs" />
|
||||
<Compile Include="Controls/Button.fs" />
|
||||
<Compile Include="Controls/ReactGrid.fs" />
|
||||
@@ -59,6 +61,10 @@
|
||||
<Compile Include="Users/Types.fs" />
|
||||
<Compile Include="Users/State.fs" />
|
||||
<Compile Include="Users/View.fs" />
|
||||
<!-- Reports -->
|
||||
<Compile Include="Reports/Types.fs" />
|
||||
<Compile Include="Reports/State.fs" />
|
||||
<Compile Include="Reports/View.fs" />
|
||||
<!-- App -->
|
||||
<Compile Include="Types.fs" />
|
||||
<Compile Include="State.fs" />
|
||||
|
||||
Reference in new issue
Block a user