Skip to content
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

Error in GetAccountPositionsHistoryAsync #40

Closed
overstartup opened this issue Aug 15, 2023 · 7 comments
Closed

Error in GetAccountPositionsHistoryAsync #40

overstartup opened this issue Aug 15, 2023 · 7 comments

Comments

@overstartup
Copy link

It seems there is an error when I want to get positions history.

var history = api.TradingAccount.GetAccountPositionsHistoryAsync(OkxInstrumentType.Swap, order.Symbol , positionId: order.PositionId.ToString(), limit: 10).Result;

it was working correctly in this version:
<PackageReference Include="OKX.Api" Version="1.1.7" />
this is the error:

[27] Deserialize JsonSerializationException: A member with the name 'uly' already exists on 'OKX.Api.Models.TradingAccount.OkxPositionHistory'. Use the JsonPropertyAttribute to specify another name. data: {
  "code": "0",
  "data": [
    {
      "cTime": "1692117524812",
      "ccy": "USDT",
      "closeAvgPx": "29274.5",
      "closeTotalPos": "43",
      "direction": "short",
      "instId": "BTC-USDT-SWAP",
      "instType": "SWAP",
      "lever": "100.0",
      "mgnMode": "cross",
      "openAvgPx": "29332",
      "openMaxPos": "43",
      "pnl": "2.4725",
      "pnlRatio": "0.19603163780172",
      "posId": "611720468101455900",
      "triggerPx": "",
      "type": "2",
      "uTime": "1692118080897",
      "uly": "BTC-USDT"
    }
  ],
  "msg": ""
}
@overstartup
Copy link
Author

@burakoner could you please check this one. Unfortunately, my software doesn't work without this method.

@vhd41
Copy link

vhd41 commented Aug 26, 2023

@overstartup
this is an issue in OKX.Api\Models\TradingAccount\OkxPositionHistory.cs
I clone and fix and use a local build .
[JsonProperty("uly")]
public string Underlying { get; set; }

[JsonProperty("uly")]
public string Currency { get; set; }

To:
[JsonProperty("uly")]
public string Underlying { get; set; }

[JsonProperty("ccy")]
public string Currency { get; set; }

It would be good if @burakoner fix and commit

@overstartup
Copy link
Author

@vhd41 thanks a lot

@overstartup
Copy link
Author

@burakoner Please solve these small things. That would be really useful.

@burakoner
Copy link
Owner

I've fixed this issue and will release new version today

@burakoner
Copy link
Owner

Version 1.4.0 has been released. Please check these out a233227 https://www.nuget.org/packages/OKX.Api/

@overstartup
Copy link
Author

It works, Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants