Documentation ¶
Overview ¶
Types and helpers for easy formatting and parsing open-finance protocol messages.
Events/metods names for open-finance.org protocol implementation client and server.
Index ¶
- Constants
- Variables
- func DescribeEvents() ([]string, [][]string)
- func DescribeTopics() ([]string, [][]string)
- type ArgIterator
- func (a *ArgIterator) Err() error
- func (a *ArgIterator) Index() int
- func (a *ArgIterator) More() bool
- func (a *ArgIterator) Next() any
- func (a *ArgIterator) NextBool() bool
- func (a *ArgIterator) NextDecimal() decimal.Decimal
- func (a *ArgIterator) NextFloat64() float64
- func (a *ArgIterator) NextInt() int
- func (a *ArgIterator) NextInt64() int64
- func (a *ArgIterator) NextInterface() any
- func (a *ArgIterator) NextSlice() []any
- func (a *ArgIterator) NextString() string
- func (a *ArgIterator) NextTimestamp() int64
- func (a *ArgIterator) NextUUID() uuid.UUID
- func (a *ArgIterator) NextUint64() uint64
- type Msg
Constants ¶
const ( // Request type code Request = 1 // Response type code Response = 2 // EventPublic is public event type code EventPublic = 3 // EventPrivate is private event type code EventPrivate = 4 // EventAdmin is admin event type code EventAdmin = 5 )
const ( EventBalanceUpdate = "bu" EventWithdrawalUpdate = "wu" EventDepositUpdate = "du" EventOrderCreate = "on" EventOrderCancel = "oc" EventOrderUpdate = "ou" EventOrderReject = "or" EventPrivateTrade = "tr" EventTrade = "trade" EventTickers = "tickers" EventMarkets = "markets" EventKLine = "kline-" EventOrderBookIncrement = "obi" EventOrderBookSnapshot = "obs" EventRawBookIncrement = "rbi" EventRawBookSnapshot = "rbs" EventSystem = "sys" EventConfig = "config" MethodAuth = "authenticate" MethodSubscribe = "subscribe" MethodUnsubscribe = "unsubscribe" MethodListOrders = "list_orders" MethodListOrdersByUUIDS = "list_orders_by_uuids" MethodListOrderTrades = "list_order_trades" MethodListChannelTrades = "list_channel_trades" MethodCreateOrder = "create_order" MethodCreateOrderBulk = "create_bulk" MethodCancelOrder = "cancel_order" MethodCancelOrdersAll = "cancel_all" MethodGetKlines = "klines" MethodGetMarkets = "get_markets" MethodGetSymbols = "get_symbols" MethodGetTokens = "get_tokens" MethodGetTokenBySymbol = "get_token_by_symbol_id" MethodGetTokenById = "get_token_by_id" MethodGetNetworks = "get_networks" MethodGetDeposits = "get_deposits" MethodGetWithdrawals = "get_withdrawals" MethodCheckSMTPConfig = "check_smtp_config" MethodSendMetrics = "send_metrics" MethodCreateDeposit = "create_deposit" MethodCreateWithdrawal = "create_withdrawal" MethodCancelDeposit = "cancel_deposit" MethodCancelWithdrawal = "cancel_withdrawal" MethodGetPublicConfig = "get_public_config" MethodSetConfig = "set_config" MethodGetConfig = "get_config" MethodGetParticipantData = "get_participation_data" MethodAddAddress = "add_address" MethodVerifyAddress = "verify_address" MethodGetAddresses = "get_addresses" MethodAdminCreateOrder = "admin_create_order" MethodAdminCancelOrder = "admin_cancel_order" MethodAdminDeposit = "admin_deposit" MethodAdminWithdraw = "admin_withdraw" OrderSideSell = "sell" OrderSideBuy = "buy" OrderStatePending = "p" OrderStateWait = "w" OrderStateDone = "d" OrderStateReject = "r" OrderStateCancel = "c" OrderStateTriggerWait = "tw" OrderStateTriggerCancel = "tc" OrderStateTriggerReject = "tr" OrderTypeLimit = "l" OrderTypeMarket = "m" OrderTypePostOnly = "p" OrderTypeFillOrKill = "f" OrderTypeStopLoss = "sl" OrderTypeStopLimit = "slm" OrderTypeTakeProfit = "tp" OrderTypeTakeLimit = "tlm" TopicBalances = "balances" TopicOrders = "order" TopicTickers = "tickers" TopicWithdrawals = "withdrawals" TopicDeposits = "deposits" TopicTrades = "trades" TopicOrderbooksInc = "ob-inc" TopicKLines = "kline-" ScopePrivate = "private" ScopePublic = "public" )
const ParseError = "unexpected message"
Variables ¶
var ErrInvalidType = errors.New("invalid type")
ErrInvalidType is returned when type conversion is not successful
var ErrIterationDone = errors.New("iteration done")
ErrIterationDone is returned when no more elements in array to iterate
var ErrValueNil = errors.New("value is nil")
ErrValueNil is returned when next value is nil
Functions ¶
func DescribeEvents ¶
func DescribeTopics ¶
Types ¶
type ArgIterator ¶
type ArgIterator struct {
// contains filtered or unexported fields
}
ArgIterator is a helper for msg arguments processing.
func NewArgIterator ¶
func NewArgIterator(args []any) *ArgIterator
NewArgIterator creates new ready-to-use iterator
func (*ArgIterator) Index ¶
func (a *ArgIterator) Index() int
Index returns current iterator position
func (*ArgIterator) More ¶
func (a *ArgIterator) More() bool
More returns true if there are values not scanned, intended to be used for iterating
func (*ArgIterator) Next ¶
func (a *ArgIterator) Next() any
Next returns next value or nil, sets ErrIterationDone
func (*ArgIterator) NextBool ¶
func (a *ArgIterator) NextBool() bool
NextBool returns next value converted to bool
func (*ArgIterator) NextDecimal ¶
func (a *ArgIterator) NextDecimal() decimal.Decimal
NextDecimal returns next value converted to decimal
func (*ArgIterator) NextFloat64 ¶
func (a *ArgIterator) NextFloat64() float64
NextFloat64 returns next value converted to float64
func (*ArgIterator) NextInt ¶
func (a *ArgIterator) NextInt() int
NextInt returns next value converted to int
func (*ArgIterator) NextInt64 ¶
func (a *ArgIterator) NextInt64() int64
NextInt64 returns next value converted to int64
func (*ArgIterator) NextInterface ¶
func (a *ArgIterator) NextInterface() any
NextInterface returns next value converted to any
func (*ArgIterator) NextSlice ¶
func (a *ArgIterator) NextSlice() []any
NextSlice returns next value converted to []any
func (*ArgIterator) NextString ¶
func (a *ArgIterator) NextString() string
NextString returns next value converted to string
func (*ArgIterator) NextTimestamp ¶
func (a *ArgIterator) NextTimestamp() int64
NextTimestamp returns next value converted to Unix()
func (*ArgIterator) NextUUID ¶
func (a *ArgIterator) NextUUID() uuid.UUID
NextUUID returns next value parsed as UUID
func (*ArgIterator) NextUint64 ¶
func (a *ArgIterator) NextUint64() uint64
NextUint64 returns next value converted to uint64
type Msg ¶
Msg represent websocket messages, it could be either a request, a response or an event