Skip to content

Commit 054218b

Browse files
authored
Order fees added (#782)
1 parent 3c7fdb6 commit 054218b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/ExchangeSharp/API/Exchanges/Bitstamp/ExchangeBitstampAPI.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,18 @@ protected override async Task<ExchangeOrderResult> OnGetOrderDetailsAsync(string
286286
}
287287
string _symbol = $"{baseCurrency}-{quoteCurrency}";
288288

289-
decimal amountFilled = 0, spentQuoteCurrency = 0, price = 0;
289+
decimal amountFilled = 0;
290+
decimal spentQuoteCurrency = 0;
291+
decimal price = 0;
292+
decimal fees = 0;
290293

291294
foreach (var t in transactions)
292295
{
293296
int type = t["type"].ConvertInvariant<int>();
294297
if (type != 2) { continue; }
295298
spentQuoteCurrency += t[quoteCurrency].ConvertInvariant<decimal>();
296299
amountFilled += t[baseCurrency].ConvertInvariant<decimal>();
300+
fees += t["fee"].ConvertInvariant<decimal>();
297301
//set price only one time
298302
if (price == 0)
299303
{
@@ -309,6 +313,8 @@ protected override async Task<ExchangeOrderResult> OnGetOrderDetailsAsync(string
309313
MarketSymbol = _symbol,
310314
AveragePrice = spentQuoteCurrency / amountFilled,
311315
Price = price,
316+
Fees = fees,
317+
FeesCurrency = quoteCurrency,
312318
Result = status,
313319
ResultCode = statusCode
314320
};

0 commit comments

Comments
 (0)