fix build: Fix merge errors (mostly trivial stuff)

This commit is contained in:
John Colvin committed 2023-04-07 12:13:44 -04:00
1 parent ccd76ec284
commit 6d3d9ddacf
14 files changed
+38 -50

No files matched your search

@@ -29,7 +29,7 @@ namespace mbts.analytics {
public VolSurfaceMDUnit(NativePriceSize bid, NativePriceSize ask,
double mark_price)
: this(bid.price, bid.size_f, ask.price, ask.size_f, mark_price) {
: this(bid.price, bid.size, ask.price, ask.size, mark_price) {
}
public bool is_two_sided() { return bid_size != 0 && ask_size != 0; }
+6 -17
View File
@@ -1,7 +1,7 @@
using bts.api;
using bts.api.core;
using bts.api.orderman;
using bts.spark;
using bts.config;
using mbts;
using mbts.config;
@@ -29,7 +29,6 @@ namespace bts.shell {
readonly IBus _bus;
readonly OrdersModel _model;
readonly UserSettingsHub _settings_hub;
readonly ErrorReporter _error_reporter;
readonly bool _close_on_send;
IReadOnlyDictionary<uint, AccountTuple> _accounts = new Dictionary<uint, AccountTuple>(0);
IReadOnlyDictionary<uint, SecurityMD> _md_map;
@@ -37,14 +36,13 @@ namespace bts.shell {
IDisposable _dispose;
[ImportingConstructor]
public OrderTicketDaemon(IBus bus, OrdersModel model, UserSettingsHub settings_hub, ErrorReporter error_reporter)
: this(bus, model, settings_hub, error_reporter, Configuration.get<bts.config.OrderTicketOptions>().CloseOnSend) { }
public OrderTicketDaemon(IBus bus, OrdersModel model, UserSettingsHub settings_hub)
: this(bus, model, settings_hub, Configuration.get<OrderTicketOptions>().CloseOnSend) { }
public OrderTicketDaemon(IBus bus, OrdersModel model, UserSettingsHub settings_hub, ErrorReporter error_reporter, bool close_on_send) {
public OrderTicketDaemon(IBus bus, OrdersModel model, UserSettingsHub settings_hub, bool close_on_send) {
_bus = bus;
_model = model;
_settings_hub = settings_hub;
_error_reporter = error_reporter;
_close_on_send = close_on_send;
_dispose = Disposable.Create(
model.on_orders.OnDispatcher().Subscribe(o => _orders = o),
@@ -120,18 +118,9 @@ namespace bts.shell {
DataContext = new ExistingOrderTicketVM(_model,
Observable.Return((md, ori.order)),
_bus.subscribe(SparkTags.AccountsTag),
Observable.Return(LadderSettings.Default.calculator_buttons)
)
Observable.Return(LadderSettings.Default.calculator_buttons),
md?.quantity_display)
});
}
LadderSettings _get_settings(SecurityImmutable sec) {
var settings = _settings_hub.current;
if (settings.ladder_profiles.TryGetFirst(
lsp => lsp.security_criteria.includes(sec), out var lsp)) {
return lsp.value;
}
return null;
}
}
}
@@ -13,6 +13,7 @@ namespace Spark.Trading {
using mbts.spark;
using mbts.ui;
using Spark.Api.Orders;
using Spark.Api.Reactive;
using Spark.Core;
using Spark.Core.Data;
@@ -90,7 +91,7 @@ namespace Spark.Trading {
(acc_orders, pnl_id) => {
var (security, account_id, account) =
acc_orders.table.state.Values.TryGetFirst(out var tup) ?
(tup.sec, tup.order.account_id(), tup.order.account()) :
(tup.security, tup.order.account_id(), tup.order.account()) :
(null, 0, null);
return new PNLRowData(pnl_id,
security: security,
@@ -105,7 +106,7 @@ namespace Spark.Trading {
PNLRowData.key_fn)
.Where(t => t.has_changes())
.Cache()
.ToObservable());
.ToObservable();
merged_positions = bootstraps.emplace(
ReconcileReportDataSource.create(
@@ -190,14 +190,12 @@
Disposable.Create(() => _vm.request_show_ladder -= show_ladder)
};
var sec_mds_src = _bus.subscribe(SparkTags.SecuritiesTag);
var secs_src = security_criteria_src
var all_sec_mds_src = _bus.subscribe(SparkTags.SecuritiesTag);
var sec_mds_src = security_criteria_src
.StartWith(() => _security_criteria)
.SelectSeries(sc => sc.subscribe_map(sec_mds_src));
.SelectSeries(sc => sc.subscribe_md_map(all_sec_mds_src));
var trades_source = TradesSource.create(
_consumer,
secs_src,
_trade_poll_interval);
_consumer, sec_mds_src, _trade_poll_interval);
trades_source = TradesSource.with_greeks(trades_source, _bus.subscribe(SparkTags.Greeks));
trades_source = TradesSource.with_volume(
trades_source, _bus.subscribe(SparkTags.SecuritiesTag));
@@ -84,7 +84,7 @@ namespace bts.shell.pnl {
get,
get_market,
new OrderPriceComparer(),
fmt_qty);
qty_display);
public PNLCellVM<TRow, WorkingOrderSideData> add_working_short(
PNLView.Columns key,
@@ -98,7 +98,7 @@ namespace bts.shell.pnl {
get,
get_market,
new ReverseComparer<double>(new OrderPriceComparer()),
fmt_qty);
qty_display);
PNLCellVM<TRow, WorkingOrderSideData> _add_working(
PNLView.Columns key,
@@ -65,7 +65,7 @@ namespace bts.shell {
var trade_secs_src = trade_criteria_src.SelectSeries(criterias => {
var secs = bus.subscribe(SparkTags.SecuritiesTag);
if (criterias.is_null_or_empty()) {
return secs.Select(smds => MappedDictionary.create(smds, s => s.security));
return secs;
}
// Take a snapshot of 'criterias' (IEnumerable) and store it in a List to:
// a) prevent potentially expensive repetative enumeration in the callbacks (for ex,
@@ -74,7 +74,7 @@ namespace bts.shell {
var criterias_list = criterias.ToList();
return secs.Select(smds =>
smds.Values.Where(s => criterias_list.Any(c => c.includes(s.security)))
.ToDictionary(s => s.id, s => s.security));
.ToDictionary(s => s.id));
});
_dispose = Disposable.Create(
bus.subscribe(SparkTags.LogActivity).Subscribe(_on_activity),
@@ -29,7 +29,7 @@ namespace mbts.spark {
OrdersModel model,
IObservable<(SecurityMD? security_md, OrderRecordImmutable order)> order_source,
IObservable<IReadOnlyDictionary<uint, AccountTuple>> accounts_source,
IObservable<double[]> calculator_buttons
IObservable<double[]> calculator_buttons,
TickDisplaySettingsImmutable? qty_display
) {
uint? key = null;
@@ -162,7 +162,7 @@
// Compare bids
if (direct.int_price == implied.int_price) {
bid[x] = new NativePriceSize(direct.int_price, direct.size_f, implied.size_f);
bid[x] = new(direct.int_price, direct.size, implied.size);
dbid_idx++;
ibid_idx++;
}
@@ -185,7 +185,7 @@
// Compare asks
if (direct.int_price == implied.int_price) {
ask[x] = new NativePriceSize(direct.int_price, direct.size_f, implied.size_f);
ask[x] = new(direct.int_price, direct.size, implied.size);
dask_idx++;
iask_idx++;
}
@@ -100,9 +100,12 @@ namespace bts.md {
}
}
public IObservable<IList<TradeInfo>> trades(TradesSubscriptionFilter filter) =>
TradesSource.create(
_source.consumer, securities(filter.security_criteria), _poll_interval);
public IObservable<IList<TradeInfo>> trades(TradesSubscriptionFilter filter) {
var sec_mds = filter.security_criteria is null ?
_source.subscribe_securities() :
filter.security_criteria.subscribe_md_map(_source.subscribe_securities());
return TradesSource.create(_source.consumer, sec_mds, _poll_interval);
}
public IObservable<TableUpdate<PriceTicker, uint>> price_ticker(
SecurityCriteria? criteria = null) {
@@ -46,7 +46,7 @@ namespace mbts.co2 {
public override string ToString() =>
$"{price} {size_f} ({implied_size})";
$"{price} {size} ({implied_size})";
public override bool Equals(object obj) =>
obj is NativePriceSize p ? Equals(p) : base.Equals(obj);
+3 -6
View File
@@ -1,9 +1,6 @@
using bts.api;
namespace bts.md {
using System;
using mbts.co2;
namespace bts.md
{
using Size = System.Single;
public class PriceSize
{
@@ -21,7 +18,7 @@ namespace bts.md
public override string ToString() {
return $"{price} {size} {implied_size} ";
}
public Object ToJsonObj() => new {
public object ToJsonObj() => new {
price = this.price,
size = this.size,
implied_size = this.implied_size
+2 -1
View File
@@ -1,4 +1,5 @@
using bts.api;
using bts.api.domain;
using bts.co2;
using mbts.analytics;
@@ -7,7 +8,7 @@ using Spark.Core;
namespace mbts.spark {
public readonly struct TradeInfo : bts.api.IJsonFormatter<TradeInfo> {
public readonly SecurityImmutable security;
public readonly SecurityMD security_md;
public readonly TradeMessageImmutable trade;
public readonly GreeksTuple? greeks_tuple;
public readonly double volume;
@@ -8,7 +8,6 @@
using mbts.analytics;
using mbts.co2;
using Spark.Core.Data;
using Spark.Core.Disposables;
using Spark.Core.Reactive;
@@ -21,19 +20,19 @@
public static class TradesSource {
public static IObservable<IList<TradeInfo>> create(
MDConsumer consumer,
IObservable<IReadOnlyDictionary<uint, SecurityImmutable>> security_map,
IObservable<IReadOnlyDictionary<uint, SecurityMD>> security_md_map,
TimeSpan poll_interval) =>
security_map.Scan(
security_md_map.Scan(
(channels: ImmutableDictionary<ProductImmutable, ChannelConsumer>.Empty, active: new List<ChannelConsumer>(0)),
(channel_data, map) => {
var (channels, active) = channel_data;
var products = map.Values.Select(s => s.product()).Distinct();
var products = map.Values.Select(s => s.security.product()).Distinct();
active = new List<ChannelConsumer>();
foreach (var p in products) {
if (!channels.TryGetValue(p, out var c)) {
c = new ChannelConsumer(
consumer.get_channel(p.Symbol, p.Type, p.Exchange),
map.Values.Where(s => s.product().Equals(p)));
map.Values.Where(s => s.security.product().Equals(p)));
channels = channels.Add(p, c);
}
active.Add(c);
+1 -1
View File
@@ -5,7 +5,7 @@ import subprocess
from cmake.cmake_utils import CMakeCompilerPair, CMakeConfigureCommand
from core.argparse_utils import add_toggle_opt, get_arg
from core.cmake_utils import CMakeCompilerPair, CMakeConfigureCommand
from core.file_utils import CWD, SparkPaths, as_path, create_dir, ensure_exists, link_dir, unlink
from core.file_utils import CWD, SparkPaths, as_path, create_dir
from core.iter_utils import distinct, flatten
from core.logging import exit_msg
from core.str_utils import wrap_dquotes