-
-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes for Bittrex and Kraken after testing live orders. #597
Conversation
…Gemini lower case symbol names. Pass isWebsocket flag in console app.
…x API returns HttpStatusCode.Created when placing an order.
…When submitting a limit order, add required timeInForce property.
@@ -252,7 +252,25 @@ protected override async Task<ExchangeTicker> OnGetTickerAsync(string marketSymb | |||
#region OrderBooks | |||
protected override async Task<ExchangeOrderBook> OnGetOrderBookAsync(string marketSymbol, int maxCount = 25) | |||
{ | |||
JToken token = await MakeJsonRequestAsync<JToken>("/markets/" + marketSymbol + "/orderbook" + marketSymbol + "&depth=" + maxCount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This URL is invalid. Fixed below.
@@ -252,7 +252,25 @@ protected override async Task<ExchangeTicker> OnGetTickerAsync(string marketSymb | |||
#region OrderBooks | |||
protected override async Task<ExchangeOrderBook> OnGetOrderBookAsync(string marketSymbol, int maxCount = 25) | |||
{ | |||
JToken token = await MakeJsonRequestAsync<JToken>("/markets/" + marketSymbol + "/orderbook" + marketSymbol + "&depth=" + maxCount); | |||
// Bittrex API allowed values are [1, 25, 500], default is 25. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -370,7 +388,7 @@ protected override async Task<ExchangeOrderResult> OnPlaceOrderAsync(ExchangeOrd | |||
if (order.OrderType == ExchangeSharp.OrderType.Limit) | |||
{ | |||
orderParams.Add("limit", orderPrice); | |||
//orderParams.Add("timeInForce", "GOOD_TIL_CANCELLED"); | |||
orderParams.Add("timeInForce", "GOOD_TIL_CANCELLED"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bittrex V3 API is saying this is a required parameter now for limit orders.
object nonce = await GenerateNonceAsync(); | ||
Dictionary<string, object> payload = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase) | ||
{ { "pair", order.MarketSymbol }, { "type", (order.IsBuy ? "buy" : "sell") }, { "ordertype", order.OrderType.ToString().ToLowerInvariant() }, { "volume", order.RoundAmount().ToStringInvariant() }, { "trading_agreement", "agree" }, { "nonce", nonce } | ||
}; | ||
if (order.OrderType != OrderType.Market) | ||
{ | ||
payload.Add("price", order.Price.ToStringInvariant()); | ||
int precision = BitConverter.GetBytes(Decimal.GetBits((decimal)market.PriceStepSize)[3])[2]; | ||
payload.Add("price", Math.Round(order.Price, precision).ToStringInvariant()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rounding avoids an error returned by Kraken's API that price
can only have so many decimals.
No description provided.