Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The following cryptocurrency exchanges are supported:
| Bittrex | x | x | T R |
| BL3P | x | x | R B | Trades stream does not send trade's ids. |
| Bleutrade | x | x | |
| BtcTurk | | | R |
| BTSE | x | x | |
| Bybit | x | x | R | Has public method for Websocket Positions
| Coinbase | x | x | T R O U |
Expand Down Expand Up @@ -112,11 +113,11 @@ See [`WebSocket4NetClientWebSocket.cs`][websocket4net] for implementation detail

#### dotnet CLI

[`dotnet add package DigitalRuby.ExchangeSharp --version 1.0.1`][nuget]
[`dotnet add package DigitalRuby.ExchangeSharp --version 1.0.2`][nuget]

#### Package Manager on VS

[`PM> Install-Package DigitalRuby.ExchangeSharp -Version 1.0.1`][nuget]
[`PM> Install-Package DigitalRuby.ExchangeSharp -Version 1.0.2`][nuget]

### Examples

Expand Down
229 changes: 123 additions & 106 deletions src/ExchangeSharp/API/Exchanges/BitMEX/ExchangeBitMEXAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,109 +88,114 @@ protected override async Task<IEnumerable<string>> OnGetMarketSymbolsAsync()
protected internal override async Task<IEnumerable<ExchangeMarket>> OnGetMarketSymbolsMetadataAsync()
{
/*
{{
"symbol": ".XRPXBT",
"rootSymbol": "XRP",
"state": "Unlisted",
"typ": "MRCXXX",
"listing": null,
"front": null,
"expiry": null,
"settle": null,
"relistInterval": null,
"inverseLeg": "",
"sellLeg": "",
"buyLeg": "",
"optionStrikePcnt": null,
"optionStrikeRound": null,
"optionStrikePrice": null,
"optionMultiplier": null,
"positionCurrency": "",
"underlying": "XRP",
"quoteCurrency": "XBT",
"underlyingSymbol": "XRPXBT=",
"reference": "PLNX",
"referenceSymbol": "BTC_XRP",
"calcInterval": null,
"publishInterval": "2000-01-01T00:01:00Z",
"publishTime": null,
"maxOrderQty": null,
"maxPrice": null,
"lotSize": null,
"tickSize": 1E-08,
"multiplier": null,
"settlCurrency": "",
"underlyingToPositionMultiplier": null,
"underlyingToSettleMultiplier": null,
"quoteToSettleMultiplier": null,
"isQuanto": false,
"isInverse": false,
"initMargin": null,
"maintMargin": null,
"riskLimit": null,
"riskStep": null,
"limit": null,
"capped": false,
"taxed": false,
"deleverage": false,
"makerFee": null,
"takerFee": null,
"settlementFee": null,
"insuranceFee": null,
"fundingBaseSymbol": "",
"fundingQuoteSymbol": "",
"fundingPremiumSymbol": "",
"fundingTimestamp": null,
"fundingInterval": null,
"fundingRate": null,
"indicativeFundingRate": null,
"rebalanceTimestamp": null,
"rebalanceInterval": null,
"openingTimestamp": null,
"closingTimestamp": null,
"sessionInterval": null,
"prevClosePrice": null,
"limitDownPrice": null,
"limitUpPrice": null,
"bankruptLimitDownPrice": null,
"bankruptLimitUpPrice": null,
"prevTotalVolume": null,
"totalVolume": null,
"volume": null,
"volume24h": null,
"prevTotalTurnover": null,
"totalTurnover": null,
"turnover": null,
"turnover24h": null,
"prevPrice24h": 7.425E-05,
"vwap": null,
"highPrice": null,
"lowPrice": null,
"lastPrice": 7.364E-05,
"lastPriceProtected": null,
"lastTickDirection": "MinusTick",
"lastChangePcnt": -0.0082,
"bidPrice": null,
"midPrice": null,
"askPrice": null,
"impactBidPrice": null,
"impactMidPrice": null,
"impactAskPrice": null,
"hasLiquidity": false,
"openInterest": 0,
"openValue": 0,
"fairMethod": "",
"fairBasisRate": null,
"fairBasis": null,
"fairPrice": null,
"markMethod": "LastPrice",
"markPrice": 7.364E-05,
"indicativeTaxRate": null,
"indicativeSettlePrice": null,
"optionUnderlyingPrice": null,
"settledPrice": null,
"timestamp": "2018-07-05T13:27:15Z"
}}
[
{
"symbol": "XBTZ14",
"rootSymbol": "XBT",
"state": "Settled",
"typ": "FXXXS",
"listing": "2014-11-21T20:00:00.000Z",
"front": "2014-11-28T12:00:00.000Z",
"expiry": "2014-12-26T12:00:00.000Z",
"settle": "2014-12-26T12:00:00.000Z",
"listedSettle": "2014-12-26T12:00:00.000Z",
"relistInterval": null,
"inverseLeg": "",
"sellLeg": "",
"buyLeg": "",
"optionStrikePcnt": null,
"optionStrikeRound": null,
"optionStrikePrice": null,
"optionMultiplier": null,
"positionCurrency": "",
"underlying": "XBT",
"quoteCurrency": "USD",
"underlyingSymbol": "XBT=",
"reference": "BMEX",
"referenceSymbol": ".XBT2H",
"calcInterval": null,
"publishInterval": null,
"publishTime": null,
"maxOrderQty": 10000000,
"maxPrice": 1000000,
"lotSize": 1,
"tickSize": 0.01,
"multiplier": 1000,
"settlCurrency": "XBt",
"underlyingToPositionMultiplier": null,
"underlyingToSettleMultiplier": 100000000,
"quoteToSettleMultiplier": null,
"isQuanto": true,
"isInverse": false,
"initMargin": 0.3,
"maintMargin": 0.2,
"riskLimit": 25000000000,
"riskStep": 5000000000,
"limit": 0.2,
"capped": false,
"taxed": false,
"deleverage": false,
"makerFee": 0.00005,
"takerFee": 0.00005,
"settlementFee": 0.00005,
"insuranceFee": 0.00015,
"fundingBaseSymbol": "",
"fundingQuoteSymbol": "",
"fundingPremiumSymbol": "",
"fundingTimestamp": null,
"fundingInterval": null,
"fundingRate": null,
"indicativeFundingRate": null,
"rebalanceTimestamp": null,
"rebalanceInterval": null,
"openingTimestamp": "2014-12-26T12:00:00.000Z",
"closingTimestamp": "2014-12-26T12:00:00.000Z",
"sessionInterval": "2000-01-01T08:00:00.000Z",
"prevClosePrice": 319,
"limitDownPrice": 255.2,
"limitUpPrice": 382.8,
"bankruptLimitDownPrice": null,
"bankruptLimitUpPrice": null,
"prevTotalVolume": 323564,
"totalVolume": 348271,
"volume": 0,
"volume24h": 0,
"prevTotalTurnover": 0,
"totalTurnover": 0,
"turnover": 0,
"turnover24h": 0,
"homeNotional24h": 0,
"foreignNotional24h": 0,
"prevPrice24h": 323.33,
"vwap": null,
"highPrice": null,
"lowPrice": null,
"lastPrice": 323.33,
"lastPriceProtected": 323.33,
"lastTickDirection": "PlusTick",
"lastChangePcnt": 0,
"bidPrice": null,
"midPrice": null,
"askPrice": null,
"impactBidPrice": null,
"impactMidPrice": null,
"impactAskPrice": null,
"hasLiquidity": false,
"openInterest": 0,
"openValue": 0,
"fairMethod": "",
"fairBasisRate": null,
"fairBasis": 0,
"fairPrice": 323.33,
"markMethod": "LastPrice",
"markPrice": 323.33,
"indicativeTaxRate": null,
"indicativeSettlePrice": 323.33,
"optionUnderlyingPrice": null,
"settledPriceAdjustmentRate": null,
"settledPrice": 323.33,
"timestamp": "2014-11-21T21:00:02.409Z"
},
*/

List<ExchangeMarket> markets = new List<ExchangeMarket>();
Expand All @@ -209,11 +214,23 @@ protected internal override async Task<IEnumerable<ExchangeMarket>> OnGetMarketS
{
market.PriceStepSize = marketSymbolToken["tickSize"].ConvertInvariant<decimal>();
market.MaxPrice = marketSymbolToken["maxPrice"].ConvertInvariant<decimal>();
//market.MinPrice = symbol["minPrice"].ConvertInvariant<decimal>();
//market.MinPrice = symbol["minPrice"].ConvertInvariant<decimal>(); - BitMex does not provide min price

market.MaxTradeSize = marketSymbolToken["maxOrderQty"].ConvertInvariant<decimal>();
//market.MinTradeSize = symbol["minQty"].ConvertInvariant<decimal>();
//market.QuantityStepSize = symbol["stepSize"].ConvertInvariant<decimal>();
var underlyingToPositionMultiplier = marketSymbolToken["underlyingToPositionMultiplier"].Type == JTokenType.Null ? 1 : marketSymbolToken["underlyingToPositionMultiplier"].ConvertInvariant<decimal>();
var contractSize = 1 / underlyingToPositionMultiplier;
var lotSize = marketSymbolToken["lotSize"].ConvertInvariant<decimal>();
var minTradeAmt = contractSize * lotSize;
var positionCurrency = marketSymbolToken["positionCurrency"]?.ToStringUpperInvariant();
if (positionCurrency == market.BaseCurrency)
{
market.MinTradeSize = market.QuantityStepSize = minTradeAmt;
}
else if (positionCurrency == market.QuoteCurrency)
{
market.MinTradeSizeInQuoteCurrency = minTradeAmt;
}
// else positionCurrency is probably null and the intrument is not active
}
catch
{
Expand Down
8 changes: 4 additions & 4 deletions src/ExchangeSharp/ExchangeSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
<LangVersion>8</LangVersion>
<PackageId>DigitalRuby.ExchangeSharp</PackageId>
<Title>ExchangeSharp - C# API for cryptocurrency exchanges</Title>
<PackageVersion>1.0.1</PackageVersion>
<PackageVersion>1.0.2</PackageVersion>
<Authors>jjxtra</Authors>
<Description>ExchangeSharp is a C# API for working with various cryptocurrency exchanges. Web sockets are also supported for some exchanges.</Description>
<Summary>Supported exchanges: Binance BitMEX Bitfinex Bithumb Bitstamp Bittrex BL3P Bleutrade BTSE Cryptopia Coinbase(GDAX) Digifinex Gemini Gitbtc Huobi Kraken Kucoin Livecoin NDAX OKCoin OKEx Poloniex TuxExchange Yobit ZBcom. Pull requests welcome.</Summary>
<PackageIcon>icon.png</PackageIcon>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageProjectUrl>https://github.com/jjxtra/ExchangeSharp</PackageProjectUrl>
<PackageProjectUrl>https://github.com/DigitalRuby/ExchangeSharp</PackageProjectUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageReleaseNotes>https://github.com/jjxtra/ExchangeSharp/releases</PackageReleaseNotes>
<PackageReleaseNotes>https://github.com/DigitalRuby/ExchangeSharp/releases</PackageReleaseNotes>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>C# crypto cryptocurrency trade trader exchange sharp socket web socket websocket signalr secure API Binance BitMEX Bitfinex Bithumb Bitstamp Bittrex BL3P Bleutrade BTSE Cryptopia Coinbase GDAX Digifinex Gemini Gitbtc Huobi Kraken Kucoin Livecoin NDAX OKCoin OKEx Poloniex TuxExchange Yobit ZBcom</PackageTags>
<RepositoryUrl>https://github.com/jjxtra/ExchangeSharp</RepositoryUrl>
<RepositoryUrl>https://github.com/DigitalRuby/ExchangeSharp</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/ExchangeSharp/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.1")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: AssemblyVersion("1.0.2")]
[assembly: AssemblyFileVersion("1.0.2")]
[assembly: InternalsVisibleTo("ExchangeSharpTests")]
4 changes: 2 additions & 2 deletions src/ExchangeSharpConsole/ExchangeSharpConsole.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<AssemblyName>exchange-sharp</AssemblyName>
<TargetFramework>net6.0</TargetFramework>
<NeutralLanguage>en</NeutralLanguage>
<AssemblyVersion>1.0.1</AssemblyVersion>
<FileVersion>1.0.1</FileVersion>
<AssemblyVersion>1.0.2</AssemblyVersion>
<FileVersion>1.0.2</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions tests/ExchangeSharpTests/ExchangeSharpTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
<NeutralLanguage>en</NeutralLanguage>
<AssemblyVersion>1.0.1</AssemblyVersion>
<FileVersion>1.0.1</FileVersion>
<AssemblyVersion>1.0.2</AssemblyVersion>
<FileVersion>1.0.2</FileVersion>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>

Expand Down