17 using System.Collections.Generic;
40 public override IReadOnlyDictionary<SecurityType, string>
DefaultMarkets {
get; } = GetDefaultMarkets(Market.Bybit);
57 if (AccountType == AccountType.Cash || security.IsInternalFeed() || security.
Type == SecurityType.Base)
72 return security.
Type switch
76 SecurityType.Base => base.GetFeeModel(security),
77 _ =>
throw new ArgumentOutOfRangeException(nameof(security), security, $
"Not supported security type {security.Type}")
89 if (security.
Type == SecurityType.CryptoFuture &&
90 security.
Symbol.
ID.
Date == SecurityIdentifier.DefaultDate)
95 return base.GetMarginInterestRateModel(security);
105 var symbol = Symbol.Create(
"BTCUSDC", SecurityType.Crypto,
MarketName);
120 out BrokerageMessageEvent message)
123 if (security.
Type != SecurityType.CryptoFuture)
125 message =
new BrokerageMessageEvent(BrokerageMessageType.Warning,
"NotSupported",
126 Messages.DefaultBrokerageModel.OrderUpdateNotSupported);
132 message =
new BrokerageMessageEvent(BrokerageMessageType.Warning,
"NotSupported",
133 $
"Order with status {order.Status} can't be modified");
139 message =
new BrokerageMessageEvent(BrokerageMessageType.Warning,
"NotSupported",
140 Messages.DefaultBrokerageModel.InvalidOrderQuantity(security, request.
Quantity.Value));
161 if (security.
Type != SecurityType.Crypto && security.
Type != SecurityType.CryptoFuture && security.
Type != SecurityType.Base)
163 message =
new BrokerageMessageEvent(BrokerageMessageType.Warning,
"NotSupported",
164 Messages.DefaultBrokerageModel.UnsupportedSecurityType(
this, security));
170 bool quantityIsValid;
181 message =
new BrokerageMessageEvent(BrokerageMessageType.Warning,
"NotSupported",
182 Messages.DefaultBrokerageModel.UnsupportedOrderType(
this, order,
183 new[] { OrderType.StopMarket, OrderType.StopLimit, OrderType.Market, OrderType.Limit }));
187 if (!quantityIsValid)
189 message =
new BrokerageMessageEvent(BrokerageMessageType.Warning,
"NotSupported",
190 Messages.DefaultBrokerageModel.InvalidOrderQuantity(security, order.
Quantity));
195 return base.CanSubmitOrder(security, order, out message);
210 private static IReadOnlyDictionary<SecurityType, string> GetDefaultMarkets(
string marketName)
212 var map = DefaultMarketMap.ToDictionary();
213 map[SecurityType.Crypto] = marketName;
214 map[SecurityType.CryptoFuture] = marketName;
215 return map.ToReadOnlyDictionary();