Compare commits
5
Commits
20.1.0_rc7
...
20.1.0_rc8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
447d3303d1 | ||
|
|
5693fc4444 | ||
|
|
8896066e2c | ||
|
|
4992f4e0cf | ||
|
|
3503946011 |
No files matched your search
@@ -114,6 +114,8 @@ namespace bts.shell {
|
||||
public static QuoteInsideMarketDistanceWithTravel QuoteInsideMarketDistanceWithTravel => new QuoteInsideMarketDistanceWithTravel { Priority = RulePriority };
|
||||
public static QuoteInsideMarketDistance QuoteInsideMarketDistance => new QuoteInsideMarketDistance { Priority = RulePriority };
|
||||
public static QuoteInsideMarketDistanceThrottle QuoteInsideMarketDistanceThrottle => new QuoteInsideMarketDistanceThrottle();
|
||||
|
||||
public static QuoteTimeBasedThrottle QuoteTimeBasedThrottle => new QuoteTimeBasedThrottle { DelayToImprove = 0, DelayToRun = 0 };
|
||||
#endregion
|
||||
|
||||
#region PreHedge
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
using bts.shell;
|
||||
using bts.spark;
|
||||
using mbts.ui.spark;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace mbts.spark {
|
||||
partial class SyntheticEditorVM {
|
||||
class QuoteTimeThrottleDelayToImproveModel : RowModelBase<uint> {
|
||||
readonly IDictionary<int, uint> _value_store = new Dictionary<int, uint>();
|
||||
|
||||
public override string display_name { get; } = "Delay to Improve (ms)";
|
||||
public override string help_text { get; } = string.Empty;
|
||||
public override string man_page { get; } = string.Empty;
|
||||
public override ParameterSection[] section_path { get; } = new[] { Sections.Quote, Subsections.TimeThrottle };
|
||||
|
||||
public void apply_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_throttle(leg_tup).DelayToImprove = _value_from_store(leg_tup);
|
||||
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_throttle(leg_tup) is QuoteTimeBasedThrottle throttle ?
|
||||
throttle.DelayToImprove :
|
||||
_value_from_store(leg_tup);
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, uint value) {
|
||||
_value_store[leg_tup.id] = value;
|
||||
if (_get_throttle(leg_tup) is QuoteTimeBasedThrottle throttle)
|
||||
throttle.DelayToImprove = value;
|
||||
}
|
||||
|
||||
protected override bool _get_enabled(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_throttle(leg_tup) != null;
|
||||
|
||||
QuoteTimeBasedThrottle _get_throttle(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.QuoteParams.TimeBasedThrottle;
|
||||
|
||||
uint _value_from_store(LegSpreaderParamsTuple leg_tup) =>
|
||||
_value_store.GetValueOrDefault(leg_tup.id, _ => SyntheticDataHelper.Defaults.QuoteTimeBasedThrottle.DelayToImprove);
|
||||
}
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
using bts.shell;
|
||||
using bts.spark;
|
||||
using mbts.ui.spark;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace mbts.spark {
|
||||
partial class SyntheticEditorVM {
|
||||
class QuoteTimeThrottleDelayToRunModel : RowModelBase<uint> {
|
||||
readonly IDictionary<int, uint> _value_store = new Dictionary<int, uint>();
|
||||
|
||||
public override string display_name { get; } = "Delay To Run (ms)";
|
||||
public override string help_text { get; } = string.Empty;
|
||||
public override string man_page { get; } = string.Empty;
|
||||
public override ParameterSection[] section_path { get; } = new[] { Sections.Quote, Subsections.TimeThrottle };
|
||||
|
||||
public void apply_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_throttle(leg_tup).DelayToRun = _value_from_store(leg_tup);
|
||||
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_throttle(leg_tup) is QuoteTimeBasedThrottle throttle ?
|
||||
throttle.DelayToRun :
|
||||
_value_from_store(leg_tup);
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, uint value) {
|
||||
_value_store[leg_tup.id] = value;
|
||||
if (_get_throttle(leg_tup) is QuoteTimeBasedThrottle throttle)
|
||||
throttle.DelayToRun = value;
|
||||
}
|
||||
|
||||
protected override bool _get_enabled(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_throttle(leg_tup) != null;
|
||||
|
||||
QuoteTimeBasedThrottle _get_throttle(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.QuoteParams.TimeBasedThrottle;
|
||||
|
||||
uint _value_from_store(LegSpreaderParamsTuple leg_tup) =>
|
||||
_value_store.GetValueOrDefault(leg_tup.id, _ => SyntheticDataHelper.Defaults.QuoteTimeBasedThrottle.DelayToRun);
|
||||
}
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
using bts.shell;
|
||||
using mbts.ui.spark;
|
||||
|
||||
namespace mbts.spark {
|
||||
partial class SyntheticEditorVM {
|
||||
class QuoteTimeThrottleEnabledModel : RowModelBase<bool> {
|
||||
readonly QuoteTimeThrottleDelayToRunModel _delay_to_run;
|
||||
readonly QuoteTimeThrottleDelayToImproveModel _delay_to_improve;
|
||||
|
||||
public QuoteTimeThrottleEnabledModel(QuoteTimeThrottleDelayToRunModel delay_to_run, QuoteTimeThrottleDelayToImproveModel delay_to_improve) {
|
||||
_delay_to_run = delay_to_run;
|
||||
_delay_to_improve = delay_to_improve;
|
||||
}
|
||||
|
||||
public override string display_name { get; } = string.Empty;
|
||||
public override string help_text { get; } = string.Empty;
|
||||
public override string man_page { get; } = string.Empty;
|
||||
public override ParameterSection[] section_path { get; } = new[] { Sections.Quote, Subsections.TimeThrottle };
|
||||
|
||||
public override bool get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.QuoteParams.TimeBasedThrottle != null;
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, bool value) {
|
||||
if (value) {
|
||||
if (leg_tup.leg_params.QuoteParams.TimeBasedThrottle == null) {
|
||||
leg_tup.leg_params.QuoteParams.TimeBasedThrottle = SyntheticDataHelper.Defaults.QuoteTimeBasedThrottle;
|
||||
_delay_to_run.apply_value(leg_tup);
|
||||
_delay_to_improve.apply_value(leg_tup);
|
||||
}
|
||||
} else {
|
||||
leg_tup.leg_params.QuoteParams.TimeBasedThrottle = null;
|
||||
}
|
||||
_delay_to_run.set_enabled(leg_tup, value);
|
||||
_delay_to_improve.set_enabled(leg_tup, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,6 +108,10 @@ namespace mbts.spark {
|
||||
"Reduces re-quoting updates by defining a region on either side " +
|
||||
"of the working quoting order, inside which quote updates will not be sent.");
|
||||
|
||||
public static ParameterSection TimeThrottle =>
|
||||
new ParameterSection("Time Throttle", true,
|
||||
"Reduces re-quoting updates by requiring a minimum amount of time to elapse between quotes.");
|
||||
|
||||
public static ParameterSection Conditional =>
|
||||
new ParameterSection("Conditional", true,
|
||||
"Reduces re-quoting updates by only quoting if N ticks away from the opposite " +
|
||||
|
||||
@@ -196,6 +196,9 @@ namespace mbts.spark {
|
||||
var quote_throttle_outside_ticks = new QuoteThrottleOutsideTicksModel();
|
||||
var quote_throttle_inside_ticks = new QuoteThrottleInsideTicksModel();
|
||||
|
||||
var quote_time_throttle_delay_to_run = new QuoteTimeThrottleDelayToRunModel();
|
||||
var quote_time_throttle_delay_to_improve = new QuoteTimeThrottleDelayToImproveModel();
|
||||
|
||||
var conditional_quoting_ticks = new ConditionalQuotingTicksModel();
|
||||
var conditional_quoting_price_type = new ConditionalQuotingPriceTypeModel();
|
||||
|
||||
@@ -232,9 +235,15 @@ namespace mbts.spark {
|
||||
new MarketDataTypeModel(),
|
||||
new ShowQuantityEnabledModel(show_quantity_quantity),
|
||||
show_quantity_quantity,
|
||||
// Throttle
|
||||
new QuoteThrottleEnabledModel(quote_throttle_inside_ticks, quote_throttle_outside_ticks),
|
||||
quote_throttle_inside_ticks,
|
||||
quote_throttle_outside_ticks,
|
||||
// Time Throttle
|
||||
new QuoteTimeThrottleEnabledModel(quote_time_throttle_delay_to_run, quote_time_throttle_delay_to_improve),
|
||||
quote_time_throttle_delay_to_run,
|
||||
quote_time_throttle_delay_to_improve,
|
||||
|
||||
new ConditionalQuoteEnabledModel(conditional_quoting_ticks, conditional_quoting_price_type),
|
||||
conditional_quoting_ticks,
|
||||
//conditional_quoting_price_type,
|
||||
|
||||
@@ -29,6 +29,7 @@ using System.Windows.Media.Animation;
|
||||
namespace mbts.spark {
|
||||
partial class LadderGridHost : Control {
|
||||
const int _min_row_count = 501, _max_row_count = 2001;
|
||||
static readonly bool _show_scrollbar = config.Configuration.get<bts.config.LadderKnobs>().show_scrollbar;
|
||||
|
||||
int _row_count = _min_row_count;
|
||||
|
||||
@@ -82,6 +83,8 @@ namespace mbts.spark {
|
||||
_ordershost = new LadderOrdersHost(this) { HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Stretch };
|
||||
var scrollViewerFactory = new FrameworkElementFactory(typeof(ScrollViewer));
|
||||
scrollViewerFactory.SetValue(FocusableProperty, false);
|
||||
if (!_show_scrollbar)
|
||||
scrollViewerFactory.SetValue(ScrollViewer.VerticalScrollBarVisibilityProperty, ScrollBarVisibility.Hidden);
|
||||
Template = new ControlTemplate() {
|
||||
VisualTree = scrollViewerFactory
|
||||
};
|
||||
|
||||
@@ -72,6 +72,7 @@ message LadderKnobs {
|
||||
optional bool open_algo_popup_on_select = 6 [default = false];
|
||||
optional bool use_algo_param_grid = 7 [default = true];
|
||||
optional uint32 max_mbo_orders = 8 [default = 200];
|
||||
optional bool show_scrollbar = 9 [default = false];
|
||||
}
|
||||
|
||||
message OrderBookOptions {
|
||||
|
||||
@@ -22,6 +22,8 @@ _hidden_order(this_leg_property.leg_params().has_quote_params() &&
|
||||
this_leg_property.leg_params().quote_params().has_quote_hidden()),
|
||||
_force_show_qty(this_leg_property.n_queue_holder_orders()==0 &&
|
||||
this_leg_property.has_show_qty()),
|
||||
_last_price_improve_time(google::protobuf::util::TimeUtil::GetEpoch()),
|
||||
_last_price_run_time(google::protobuf::util::TimeUtil::GetEpoch()),
|
||||
_is_permenantly_cancelled (false),
|
||||
_irrecoverable_error(false),
|
||||
_n_spreader_legs (n_spreader_legs),
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "lib/orderman/orders/spreader_orders/spreader/SpreaderChildOrderState.h"
|
||||
#include "lib/orderman/orders/spreader_orders/spreader/quoter/QuoteDriverSetHistory.h"
|
||||
#include <sstream>
|
||||
#include <google/protobuf/timestamp.pb.h>
|
||||
#include <google/protobuf/util/time_util.h>
|
||||
|
||||
|
||||
namespace bts {
|
||||
@@ -43,6 +45,8 @@ private:
|
||||
// if this is set to true, _compute_price_quantity
|
||||
// will use LegPropertyData::show_qty()
|
||||
const bool _force_show_qty;
|
||||
google::protobuf::Timestamp _last_price_improve_time,
|
||||
_last_price_run_time;
|
||||
bool _is_permenantly_cancelled;
|
||||
bool _irrecoverable_error;
|
||||
// this is a config constant. if the quoter
|
||||
@@ -177,6 +181,13 @@ private:
|
||||
_spreader.current_time());
|
||||
}
|
||||
void _modify_order (Price price, Quantity quantity) {
|
||||
auto now = google::protobuf::util::TimeUtil::GetCurrentTime();
|
||||
if(bts::securities::is_equal_or_better(_this_leg_data.trading_side(),
|
||||
price,
|
||||
_price_quantity_state.out_price()))
|
||||
_last_price_improve_time = now;
|
||||
else
|
||||
_last_price_run_time = now;
|
||||
_child_order_state.modify_order(price, quantity);
|
||||
}
|
||||
void _cancel_order () {_child_order_state.cancel_order();}
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "lib/api/services/OrderService.pb.h"
|
||||
#include "lib/orderman/actors/order_manager/OrderBuilder.h"
|
||||
#include "lib/os/os.h"
|
||||
#include <google/protobuf/timestamp.pb.h>
|
||||
#include <google/protobuf/util/time_util.h>
|
||||
#include <random>
|
||||
|
||||
namespace bts {
|
||||
@@ -290,6 +292,8 @@ public:
|
||||
const Book& qbook,
|
||||
api::Side quote_side,
|
||||
double tick_size,
|
||||
google::protobuf::Timestamp last_price_improve_time,
|
||||
google::protobuf::Timestamp last_price_run_time,
|
||||
const bts::spark::QuoteParams& quote_params){
|
||||
|
||||
bool reject =
|
||||
@@ -305,7 +309,16 @@ public:
|
||||
qbook.side(quote_side)[0].price(),
|
||||
quote_side,
|
||||
tick_size,
|
||||
quote_params.quote_inside_market_distance_throttle()));
|
||||
quote_params.quote_inside_market_distance_throttle())) ||
|
||||
(quote_params.has_time_based_throttle() &&
|
||||
is_time_throttle_reject(quote_side,
|
||||
current_price,
|
||||
new_price,
|
||||
last_price_improve_time,
|
||||
last_price_run_time,
|
||||
quote_params.time_based_throttle().delay_to_improve(),
|
||||
quote_params.time_based_throttle().delay_to_run()));
|
||||
|
||||
return reject;
|
||||
}
|
||||
|
||||
@@ -344,6 +357,32 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool is_time_throttle_reject(api::Side side,
|
||||
double current_price,
|
||||
double new_price,
|
||||
google::protobuf::Timestamp last_price_improve_time,
|
||||
google::protobuf::Timestamp last_price_run_time,
|
||||
uint32_t delay_to_improve,
|
||||
uint32_t delay_to_run){
|
||||
auto now = google::protobuf::util::TimeUtil::GetCurrentTime();
|
||||
if(bts::securities::is_equal_or_better(side,
|
||||
Price(new_price),
|
||||
Price(current_price))){
|
||||
// improvement
|
||||
int64_t ms_diff =
|
||||
google::protobuf::util::TimeUtil::TimestampToMilliseconds(now)-
|
||||
google::protobuf::util::TimeUtil::TimestampToMilliseconds(last_price_improve_time);
|
||||
return ms_diff < static_cast<int64_t>(delay_to_improve);
|
||||
}
|
||||
else{
|
||||
// run
|
||||
int64_t ms_diff =
|
||||
google::protobuf::util::TimeUtil::TimestampToMilliseconds(now)-
|
||||
google::protobuf::util::TimeUtil::TimestampToMilliseconds(last_price_run_time);
|
||||
return ms_diff < static_cast<int64_t>(delay_to_run);
|
||||
}
|
||||
}
|
||||
|
||||
static bool conditional_quoting(Price quoting_price,
|
||||
Quantity quoting_qty,
|
||||
|
||||
+4
-1
@@ -41,7 +41,8 @@ void QuoterWorkingStateWorker::cancel(){
|
||||
void QuoterWorkingStateWorker::terminate(){
|
||||
_quoter->_transform_to_END ();
|
||||
}
|
||||
void QuoterWorkingStateWorker::on_time(const TimeStamp&){
|
||||
void QuoterWorkingStateWorker::on_time(const TimeStamp&){
|
||||
_longpath_analyze_and_act();
|
||||
}
|
||||
void QuoterWorkingStateWorker::on_other_leg_quoter_fill (size_t leg_index,
|
||||
Quantity filled_quantity){
|
||||
@@ -92,6 +93,8 @@ void QuoterWorkingStateWorker::_longpath_analyze_and_act ()
|
||||
book,
|
||||
_quoter->_this_leg_data.trading_side(),
|
||||
_quoter->_this_leg_data.tick_size(),
|
||||
_quoter->_last_price_improve_time,
|
||||
_quoter->_last_price_run_time,
|
||||
_quoter->_this_leg_data.leg_params().quote_params());
|
||||
bool reprice = !throttle_reject;
|
||||
reprice = reprice && !(_quoter->_spreader.in_cache_warming_cycle());
|
||||
|
||||
Reference in new issue
Block a user