initialization : editing
This commit is contained in:
1 parent
781e7c98a0
commit
92bdbd460a
1 file changed
+5
-8
@@ -8,11 +8,11 @@ Each Algo derives from IAlgoOrder and overrides virtual methods to receive callb
|
||||
|
||||
## Before Launch
|
||||
|
||||
When an order is activated by a user or by another Algo the first call it receives is do_before_launch. This call happens outside of the latency sensitive path so it's a good place to validate parameters and set up data structures that the Algo might need.
|
||||
When an order is activated by a user or by another Algo, the first call it receives is do_before_launch. This call happens outside of the latency-sensitive path, so it's the place to validate parameters and set up data structures that the Algo might need.
|
||||
|
||||
This call returns an OrderOpResult which allows it to fail and return an error message to its creator. If the order was created by a user this message will be displayed in the [Activity Log](https://www.bluetradingsystems.com/docs/bts_spark/Help/#activity-log) and across the bottom of the ladder.
|
||||
This call returns an OrderOpResult, which allows it to fail and return an error message to its creator. If a user created this order, this message is displayed in the [Activity Log](https://www.bluetradingsystems.com/docs/bts_spark/Help/#activity-log) and across the bottom of the ladder.
|
||||
|
||||
Every SDK Algo is a "Dynamic" Algo since it's parameters are defined during [registration](/algo/ref/registration/). Use the `get_if<T>` helper to retrieve a named parameter from the `order_params` collection as a `std::option<T>`. If a parameter has a valid default value you can use `std::option::value_or(...)` to set default values for missing parameters. If a parameter *must* exist or must be within a certain valid range to continue return an error to the caller.
|
||||
Every SDK Algo is a "Dynamic" Algo since it's parameters are defined during [registration](/algo/ref/registration/). Use the `get_if<T>` helper to retrieve a named parameter from the `order_params` collection as a `std::option<T>`. If a parameter has a valid default value you can use `std::option::value_or(...)` to set default values for missing parameters. If a parameter *must* exist or must be within a certain valid range, return an error to the caller.
|
||||
|
||||
```cpp
|
||||
OrderOpResult MyAlgo::do_before_launch(IBeforeLaunchAlgoServices& serv) {
|
||||
@@ -79,7 +79,7 @@ class IBeforeLaunchAlgoServices {
|
||||
|
||||
Depending on the state of `is_attaching()` the next call will either be `do_launch` or `do_launch_attached`. The only difference is that in `do_launch_attached` the existing OrderKey and ChildState are provided.
|
||||
|
||||
`do_launch` and `do_launch_attached` are in the latency sensitive path and should not do more work than needed. They get a reference to `IAlgoServices` which is a super-set of the functionality available on `IBeforeLaunchAlgoServices`. Most Algos will want to store a pointer or reference to this object for managing child orders (it will have a stable address).
|
||||
`do_launch` and `do_launch_attached` are in the latency-sensitive path and should not do more work than needed. These functions get a reference to `IAlgoServices`, which is a superset of the functionality available on `IBeforeLaunchAlgoServices`. Most Algos should store a pointer or reference to this object for managing child orders (it has a stable address).
|
||||
|
||||
Now is the time to use `IAlgoServices` to subscribe to market events that are relevant to your Algo and create any child orders that need to exist at the start of your Algo. You can safely call IAlgoServices from any `IAlgoOrder` callback.
|
||||
|
||||
@@ -93,8 +93,5 @@ To learn more about subscribing to events see [subscriptions](/algo/ref/subscrip
|
||||
|
||||
## Update
|
||||
|
||||
If the user or parent Algo changes the order parameters (price, size, or the custom parameters defined during registration) the Algo will get the `do_update` callback with the new parameters. It is up to the Algo to decide how to apply those parameters to update the state of its child orders.
|
||||
If the user or parent Algo changes the order parameters (price, size, or the custom parameters defined during registration), Spark calls the `do_update` callback with the new parameters. It is up to the Algo to decide how to apply the new parameters to update the running state. It can do this by canceling, changing, or adding new child orders.
|
||||
|
||||
<!--
|
||||
TODO: does update get called when you get a fill? Does that only happen when you fill yourself?
|
||||
-->
|
||||
Reference in new issue
Block a user