burakoner / OKX.Api

Up-to-date, most-complete, well-organized, well-documented, easy-to-use, multi-task and multi-thread compatible OKX Cryptocurrency Exchange Rest and Websocket Api Wrapper
MIT License
39 stars 15 forks source link

Error in GetAccountPositionsHistoryAsync #40

Closed overstartup closed 11 months ago

overstartup commented 1 year ago

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 commented 1 year ago

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

vhd41 commented 1 year ago

@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 commented 1 year ago

@vhd41 thanks a lot

overstartup commented 12 months ago

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

burakoner commented 11 months ago

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

burakoner commented 11 months ago

Version 1.4.0 has been released. Please check these out https://github.com/burakoner/OKX.Api/commit/a2332273d6d885f3b58a532bc5d63793da3634d8 https://www.nuget.org/packages/OKX.Api/

overstartup commented 11 months ago

It works, Thanks