Skip to content
Merged
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
30 changes: 29 additions & 1 deletion src/ExchangeSharp/API/Exchanges/FTX/ExchangeFTXAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,34 @@ protected async override Task<IEnumerable<KeyValuePair<string, ExchangeTicker>>>
return tickers;
}

protected override async Task<ExchangeTicker> OnGetTickerAsync(string marketSymbol)
{
var result = await MakeJsonRequestAsync<JToken>($"/markets/{marketSymbol}");

return await this.ParseTickerAsync(result, marketSymbol, "ask", "bid", "last", null, null, "time", TimestampType.UnixSecondsDouble);
}

protected override async Task<ExchangeWithdrawalResponse> OnWithdrawAsync(ExchangeWithdrawalRequest request)
{
var parameters = new Dictionary<string, object>
{
{ "coin", request.Currency },
{ "size", request.Amount },
{ "address", request.Address },
{ "tag", request.AddressTag },
{ "nonce", await GenerateNonceAsync() },
{ "password", request.Password },
{ "code", request.Code }
};

var result = await MakeJsonRequestAsync<JToken>("/wallet/withdrawals", null, parameters, "POST");

return new ExchangeWithdrawalResponse
{
Id = result["id"].ToString()
};
}

/// <inheritdoc />
protected override async Task<IWebSocket> OnGetTickersWebSocketAsync(Action<IReadOnlyCollection<KeyValuePair<string, ExchangeTicker>>> tickers, params string[] marketSymbols)
{
Expand Down Expand Up @@ -389,7 +417,7 @@ protected async override Task<ExchangeOrderResult> OnPlaceOrderAsync(ExchangeOrd
{"market", market.MarketSymbol},
{"side", order.IsBuy ? "buy" : "sell" },
{"type", order.OrderType.ToStringLowerInvariant() },
{"size", order.RoundAmount() },
{"size", order.RoundAmount() }
};

if (!string.IsNullOrEmpty(order.ClientOrderId))
Expand Down