Repository navigation
feat(forex): add ForexContext for the currency-exchange channel - #128
Open
hogan-yuan wants to merge 1 commit into
Open
hogan-yuan wants to merge 1 commit into
hogan-yuan wants to merge 1 commit into
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports longbridge/openapi: new
forex.ForexContextfor the currency-exchangechannel, mirroring the Rust core across 3 methods:
Quote—POST /v1/forex/quote→ rate + quote_idSubmitOrder—POST /v1/forex/order→ accepted only (returns justerror)Order—GET /v1/forex/order→ poll byclient_order_idto a terminal stateNotes
ForexOrderStatusis an integer-coded enum (ForexOrderProcessing/ForexOrderSuccess/ForexOrderFailed) with aString()helper.Rateis adecimal.Decimal; the order'sRate/FromAmount/ToAmountare*decimal.Decimal, nil until the order is filled (they arriveempty on the wire, left nil by the string→decimal copy's empty handling).
ExpireAtis Unix ms via the string-tolerantjsontypes.Int64.GetForexQuote.Amount/TargetAmount; the servervalidates the choice. Error codes
603001–603010surface as the standard API error.Related
Core SDK (all other layers): longbridge/openapi#602