Skip to content

Commit 0fb4da6

Browse files
authored
FTX OnGetTickerAsync and OnWithdrawAsync (#675)
1 parent 4da6f4c commit 0fb4da6

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

src/ExchangeSharp/API/Exchanges/FTX/ExchangeFTXAPI.cs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,34 @@ protected async override Task<IEnumerable<KeyValuePair<string, ExchangeTicker>>>
325325
return tickers;
326326
}
327327

328+
protected override async Task<ExchangeTicker> OnGetTickerAsync(string marketSymbol)
329+
{
330+
var result = await MakeJsonRequestAsync<JToken>($"/markets/{marketSymbol}");
331+
332+
return await this.ParseTickerAsync(result, marketSymbol, "ask", "bid", "last", null, null, "time", TimestampType.UnixSecondsDouble);
333+
}
334+
335+
protected override async Task<ExchangeWithdrawalResponse> OnWithdrawAsync(ExchangeWithdrawalRequest request)
336+
{
337+
var parameters = new Dictionary<string, object>
338+
{
339+
{ "coin", request.Currency },
340+
{ "size", request.Amount },
341+
{ "address", request.Address },
342+
{ "tag", request.AddressTag },
343+
{ "nonce", await GenerateNonceAsync() },
344+
{ "password", request.Password },
345+
{ "code", request.Code }
346+
};
347+
348+
var result = await MakeJsonRequestAsync<JToken>("/wallet/withdrawals", null, parameters, "POST");
349+
350+
return new ExchangeWithdrawalResponse
351+
{
352+
Id = result["id"].ToString()
353+
};
354+
}
355+
328356
/// <inheritdoc />
329357
protected override async Task<IWebSocket> OnGetTickersWebSocketAsync(Action<IReadOnlyCollection<KeyValuePair<string, ExchangeTicker>>> tickers, params string[] marketSymbols)
330358
{
@@ -389,7 +417,7 @@ protected async override Task<ExchangeOrderResult> OnPlaceOrderAsync(ExchangeOrd
389417
{"market", market.MarketSymbol},
390418
{"side", order.IsBuy ? "buy" : "sell" },
391419
{"type", order.OrderType.ToStringLowerInvariant() },
392-
{"size", order.RoundAmount() },
420+
{"size", order.RoundAmount() }
393421
};
394422

395423
if (!string.IsNullOrEmpty(order.ClientOrderId))

0 commit comments

Comments
 (0)