Skip to content

feat(forex): add ForexContext for the currency-exchange channel - #128

Open
hogan-yuan wants to merge 1 commit into
mainfrom
feat/forex-openapi
Open

hogan-yuan wants to merge 1 commit into
mainfrom
feat/forex-openapi

Conversation

@hogan-yuan

Copy link
Copy Markdown
Member

Summary

Ports longbridge/openapi: new forex.ForexContext for the currency-exchange
channel, mirroring the Rust core across 3 methods:

  • Quote — POST /v1/forex/quote → rate + quote_id
  • SubmitOrder — POST /v1/forex/order → accepted only (returns just error)
  • Order — GET /v1/forex/order → poll by client_order_id to a terminal state

Notes

  • ForexOrderStatus is an integer-coded enum (ForexOrderProcessing /
    ForexOrderSuccess / ForexOrderFailed) with a String() helper.
  • Quote Rate is a decimal.Decimal; the order's Rate / FromAmount /
    ToAmount are *decimal.Decimal, nil until the order is filled (they arrive
    empty on the wire, left nil by the string→decimal copy's empty handling).
  • ExpireAt is Unix ms via the string-tolerant jsontypes.Int64.
  • Provide at most one of GetForexQuote.Amount / TargetAmount; the server
    validates the choice. Error codes 603001–603010 surface as the standard API error.

Related

Core SDK (all other layers): longbridge/openapi#602

Ports longbridge/openapi: new forex.ForexContext with Quote / SubmitOrder /
Order (POST /v1/forex/quote, POST /v1/forex/order, GET /v1/forex/order).
Conversion is asynchronous — SubmitOrder returns only acceptance; poll Order
by client_order_id for the terminal state. ForexOrderStatus is an integer-coded
enum; the quote rate is a decimal and the order amounts are *decimal.Decimal
(nil until filled, empty on the wire via the string-tolerant Int64/empty copy).
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

Successfully merging this pull request may close these issues.

1 participant