@@ -88,109 +88,114 @@ protected override async Task<IEnumerable<string>> OnGetMarketSymbolsAsync()
8888 protected internal override async Task < IEnumerable < ExchangeMarket > > OnGetMarketSymbolsMetadataAsync ( )
8989 {
9090 /*
91- {{
92- "symbol": ".XRPXBT",
93- "rootSymbol": "XRP",
94- "state": "Unlisted",
95- "typ": "MRCXXX",
96- "listing": null,
97- "front": null,
98- "expiry": null,
99- "settle": null,
100- "relistInterval": null,
101- "inverseLeg": "",
102- "sellLeg": "",
103- "buyLeg": "",
104- "optionStrikePcnt": null,
105- "optionStrikeRound": null,
106- "optionStrikePrice": null,
107- "optionMultiplier": null,
108- "positionCurrency": "",
109- "underlying": "XRP",
110- "quoteCurrency": "XBT",
111- "underlyingSymbol": "XRPXBT=",
112- "reference": "PLNX",
113- "referenceSymbol": "BTC_XRP",
114- "calcInterval": null,
115- "publishInterval": "2000-01-01T00:01:00Z",
116- "publishTime": null,
117- "maxOrderQty": null,
118- "maxPrice": null,
119- "lotSize": null,
120- "tickSize": 1E-08,
121- "multiplier": null,
122- "settlCurrency": "",
123- "underlyingToPositionMultiplier": null,
124- "underlyingToSettleMultiplier": null,
125- "quoteToSettleMultiplier": null,
126- "isQuanto": false,
127- "isInverse": false,
128- "initMargin": null,
129- "maintMargin": null,
130- "riskLimit": null,
131- "riskStep": null,
132- "limit": null,
133- "capped": false,
134- "taxed": false,
135- "deleverage": false,
136- "makerFee": null,
137- "takerFee": null,
138- "settlementFee": null,
139- "insuranceFee": null,
140- "fundingBaseSymbol": "",
141- "fundingQuoteSymbol": "",
142- "fundingPremiumSymbol": "",
143- "fundingTimestamp": null,
144- "fundingInterval": null,
145- "fundingRate": null,
146- "indicativeFundingRate": null,
147- "rebalanceTimestamp": null,
148- "rebalanceInterval": null,
149- "openingTimestamp": null,
150- "closingTimestamp": null,
151- "sessionInterval": null,
152- "prevClosePrice": null,
153- "limitDownPrice": null,
154- "limitUpPrice": null,
155- "bankruptLimitDownPrice": null,
156- "bankruptLimitUpPrice": null,
157- "prevTotalVolume": null,
158- "totalVolume": null,
159- "volume": null,
160- "volume24h": null,
161- "prevTotalTurnover": null,
162- "totalTurnover": null,
163- "turnover": null,
164- "turnover24h": null,
165- "prevPrice24h": 7.425E-05,
166- "vwap": null,
167- "highPrice": null,
168- "lowPrice": null,
169- "lastPrice": 7.364E-05,
170- "lastPriceProtected": null,
171- "lastTickDirection": "MinusTick",
172- "lastChangePcnt": -0.0082,
173- "bidPrice": null,
174- "midPrice": null,
175- "askPrice": null,
176- "impactBidPrice": null,
177- "impactMidPrice": null,
178- "impactAskPrice": null,
179- "hasLiquidity": false,
180- "openInterest": 0,
181- "openValue": 0,
182- "fairMethod": "",
183- "fairBasisRate": null,
184- "fairBasis": null,
185- "fairPrice": null,
186- "markMethod": "LastPrice",
187- "markPrice": 7.364E-05,
188- "indicativeTaxRate": null,
189- "indicativeSettlePrice": null,
190- "optionUnderlyingPrice": null,
191- "settledPrice": null,
192- "timestamp": "2018-07-05T13:27:15Z"
193- }}
91+ [
92+ {
93+ "symbol": "XBTZ14",
94+ "rootSymbol": "XBT",
95+ "state": "Settled",
96+ "typ": "FXXXS",
97+ "listing": "2014-11-21T20:00:00.000Z",
98+ "front": "2014-11-28T12:00:00.000Z",
99+ "expiry": "2014-12-26T12:00:00.000Z",
100+ "settle": "2014-12-26T12:00:00.000Z",
101+ "listedSettle": "2014-12-26T12:00:00.000Z",
102+ "relistInterval": null,
103+ "inverseLeg": "",
104+ "sellLeg": "",
105+ "buyLeg": "",
106+ "optionStrikePcnt": null,
107+ "optionStrikeRound": null,
108+ "optionStrikePrice": null,
109+ "optionMultiplier": null,
110+ "positionCurrency": "",
111+ "underlying": "XBT",
112+ "quoteCurrency": "USD",
113+ "underlyingSymbol": "XBT=",
114+ "reference": "BMEX",
115+ "referenceSymbol": ".XBT2H",
116+ "calcInterval": null,
117+ "publishInterval": null,
118+ "publishTime": null,
119+ "maxOrderQty": 10000000,
120+ "maxPrice": 1000000,
121+ "lotSize": 1,
122+ "tickSize": 0.01,
123+ "multiplier": 1000,
124+ "settlCurrency": "XBt",
125+ "underlyingToPositionMultiplier": null,
126+ "underlyingToSettleMultiplier": 100000000,
127+ "quoteToSettleMultiplier": null,
128+ "isQuanto": true,
129+ "isInverse": false,
130+ "initMargin": 0.3,
131+ "maintMargin": 0.2,
132+ "riskLimit": 25000000000,
133+ "riskStep": 5000000000,
134+ "limit": 0.2,
135+ "capped": false,
136+ "taxed": false,
137+ "deleverage": false,
138+ "makerFee": 0.00005,
139+ "takerFee": 0.00005,
140+ "settlementFee": 0.00005,
141+ "insuranceFee": 0.00015,
142+ "fundingBaseSymbol": "",
143+ "fundingQuoteSymbol": "",
144+ "fundingPremiumSymbol": "",
145+ "fundingTimestamp": null,
146+ "fundingInterval": null,
147+ "fundingRate": null,
148+ "indicativeFundingRate": null,
149+ "rebalanceTimestamp": null,
150+ "rebalanceInterval": null,
151+ "openingTimestamp": "2014-12-26T12:00:00.000Z",
152+ "closingTimestamp": "2014-12-26T12:00:00.000Z",
153+ "sessionInterval": "2000-01-01T08:00:00.000Z",
154+ "prevClosePrice": 319,
155+ "limitDownPrice": 255.2,
156+ "limitUpPrice": 382.8,
157+ "bankruptLimitDownPrice": null,
158+ "bankruptLimitUpPrice": null,
159+ "prevTotalVolume": 323564,
160+ "totalVolume": 348271,
161+ "volume": 0,
162+ "volume24h": 0,
163+ "prevTotalTurnover": 0,
164+ "totalTurnover": 0,
165+ "turnover": 0,
166+ "turnover24h": 0,
167+ "homeNotional24h": 0,
168+ "foreignNotional24h": 0,
169+ "prevPrice24h": 323.33,
170+ "vwap": null,
171+ "highPrice": null,
172+ "lowPrice": null,
173+ "lastPrice": 323.33,
174+ "lastPriceProtected": 323.33,
175+ "lastTickDirection": "PlusTick",
176+ "lastChangePcnt": 0,
177+ "bidPrice": null,
178+ "midPrice": null,
179+ "askPrice": null,
180+ "impactBidPrice": null,
181+ "impactMidPrice": null,
182+ "impactAskPrice": null,
183+ "hasLiquidity": false,
184+ "openInterest": 0,
185+ "openValue": 0,
186+ "fairMethod": "",
187+ "fairBasisRate": null,
188+ "fairBasis": 0,
189+ "fairPrice": 323.33,
190+ "markMethod": "LastPrice",
191+ "markPrice": 323.33,
192+ "indicativeTaxRate": null,
193+ "indicativeSettlePrice": 323.33,
194+ "optionUnderlyingPrice": null,
195+ "settledPriceAdjustmentRate": null,
196+ "settledPrice": 323.33,
197+ "timestamp": "2014-11-21T21:00:02.409Z"
198+ },
194199 */
195200
196201 List < ExchangeMarket > markets = new List < ExchangeMarket > ( ) ;
@@ -209,11 +214,23 @@ protected internal override async Task<IEnumerable<ExchangeMarket>> OnGetMarketS
209214 {
210215 market . PriceStepSize = marketSymbolToken [ "tickSize" ] . ConvertInvariant < decimal > ( ) ;
211216 market . MaxPrice = marketSymbolToken [ "maxPrice" ] . ConvertInvariant < decimal > ( ) ;
212- //market.MinPrice = symbol["minPrice"].ConvertInvariant<decimal>();
217+ //market.MinPrice = symbol["minPrice"].ConvertInvariant<decimal>(); - BitMex does not provide min price
213218
214219 market . MaxTradeSize = marketSymbolToken [ "maxOrderQty" ] . ConvertInvariant < decimal > ( ) ;
215- //market.MinTradeSize = symbol["minQty"].ConvertInvariant<decimal>();
216- //market.QuantityStepSize = symbol["stepSize"].ConvertInvariant<decimal>();
220+ var underlyingToPositionMultiplier = marketSymbolToken [ "underlyingToPositionMultiplier" ] . Type == JTokenType . Null ? 1 : marketSymbolToken [ "underlyingToPositionMultiplier" ] . ConvertInvariant < decimal > ( ) ;
221+ var contractSize = 1 / underlyingToPositionMultiplier ;
222+ var lotSize = marketSymbolToken [ "lotSize" ] . ConvertInvariant < decimal > ( ) ;
223+ var minTradeAmt = contractSize * lotSize ;
224+ var positionCurrency = marketSymbolToken [ "positionCurrency" ] ? . ToStringUpperInvariant ( ) ;
225+ if ( positionCurrency == market . BaseCurrency )
226+ {
227+ market . MinTradeSize = market . QuantityStepSize = minTradeAmt ;
228+ }
229+ else if ( positionCurrency == market . QuoteCurrency )
230+ {
231+ market . MinTradeSizeInQuoteCurrency = minTradeAmt ;
232+ }
233+ // else positionCurrency is probably null and the intrument is not active
217234 }
218235 catch
219236 {
0 commit comments