public async Task <PositionDto> GetPositionAsync(Guid accountId, Xchange exchange, string symbol, CancellationToken token = default) { var requestObject = _descriptorService.RequestDictionary(exchange, XchangeHttpOperation.GetPosition, new ObjectDictionary() { { IXchangeDescriptorService.SymbolString, symbol } }); var response = await _restRequestService.SendRequestObjectAsync(accountId, requestObject, token).ConfigureAwait(false); var result = TypeSerializer.DeserializeFromString <PositionDto>(response.Result); result.AccountId = accountId; result.Exchange = exchange; result.Timestamp = result.Timestamp; return(result); }
public async Task <OrderDto[]> GetOpenOrdersAsync(Xchange exchange, Guid accountId, string symbol, CancellationToken token = default) { var route = _descriptorService.RequestDictionary(exchange, XchangeHttpOperation.GetOrder, new ObjectDictionary() { { IXchangeDescriptorService.SymbolString, symbol } }); var res = await _restRequestService.SendRequestObjectAsync(accountId, route, token).ConfigureAwait(false); var result = TypeSerializer.DeserializeFromString <OrderDto[]>(res.Result); result.Each(p => { p.AccountId = accountId; p.Exchange = exchange; p.Timestamp = res.Timestamp; }); return(result); }
public async Task <MarginDto[]> GetMarginAsync(Guid accountId, Xchange exchange, string currency, CancellationToken token = default) { var route = _descriptorService.RequestDictionary(exchange, XchangeHttpOperation.GetMargin, new ObjectDictionary() { { _currencyString, currency } }); var response = await _restRequestService.SendRequestObjectAsync(accountId, route, token).ConfigureAwait(false); var result = TypeSerializer.DeserializeFromString <MarginDto[]>(response.Result); result.Each(p => { p.AccountId = accountId; p.Exchange = exchange; p.Timestamp = response.Timestamp; }); return(result); }