alpacahq / alpaca-trade-api-go

Go client for Alpaca's trade API
Apache License 2.0
330 stars 93 forks source link

Account model is missing fields returned by the API #288

Open gcatlin opened 4 months ago

gcatlin commented 4 months ago

https://docs.alpaca.markets/reference/getaccount-1

ankitsridhar16 commented 4 months ago

@gcatlin I looked at the response body for the link you have shared, it is missing some of these fields mentioned in the previous comment

gcatlin commented 4 months ago

Are you using the Trading API or Broker API? Live or Paper?

With the Trading API in my Paper account, I see:

{
  "id": "8fe4b465-0ba4-4bbf-a871-8a91c0e47c23",
  "admin_configurations": {},
  "user_configurations": null,
  "account_number": "XXXXXXXXXXXX",
  "status": "ACTIVE",
  "crypto_status": "ACTIVE",
  "options_approved_level": 2,
  "options_trading_level": 2,
  "currency": "USD",
  "buying_power": "277308.2",
  "regt_buying_power": "133625.42",
  "daytrading_buying_power": "277308.2",
  "effective_buying_power": "277308.2",
  "non_marginable_buying_power": "63476.32",
  "options_buying_power": "69634.39",
  "bod_dtbp": "277308.36",
  "cash": "59758.51",
  "accrued_fees": "0",
  "pending_transfer_in": "0",
  "portfolio_value": "78687.61",
  "pattern_day_trader": true,
  "trading_blocked": false,
  "transfers_blocked": false,
  "account_blocked": false,
  "created_at": "2023-03-22T00:08:02.208193Z",
  "trade_suspended_by_user": false,
  "multiplier": "4",
  "shorting_enabled": true,
  "equity": "78687.61",
  "last_equity": "78373.617164829",
  "long_market_value": "18929.1",
  "short_market_value": "0",
  "position_market_value": "18929.1",
  "initial_margin": "11874.9",
  "maintenance_margin": "9053.22",
  "last_maintenance_margin": "10286.28",
  "sma": "72830.36",
  "daytrade_count": 1,
  "balance_asof": "2024-07-01",
  "crypto_tier": 1,
  "intraday_adjustments": "0",
  "pending_reg_taf_fees": "0.04"
}

Some of those fields are missing from the documentation.

ankitsridhar16 commented 4 months ago

Okay. I just looked at the documentation and some of the fields were missing. I can work on this.

gcatlin commented 4 months ago

@ankitsridhar16 admin_configurations and user_configurations may not be worth adding until they are documented, since admin_configurations is an object and user_configurations might also be an object.

@gnvk should those 2 fields be tagged with omitempty on the server?

Neither are documented in the OpenAPI specs (Trading API, BrokerAPI).

ankitsridhar16 commented 4 months ago

@gcatlin I have created a PR for this - https://github.com/alpacahq/alpaca-trade-api-go/pull/295 can you take a look and suggest changes/additions accordingly