exante

package
v0.0.0-...-0f447c4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Scopes = []string{
	"crossrates", "change", "crossrates", "summary",
	"symbols", "feed", "ohlc", "orders", "transactions",
	"accounts",
}

Functions

This section is empty.

Types

type Api

type Api struct {
	BaseURL       string `json:"baseURL"`
	ApplicationID string `json:"applicationID"`
	ClientID      string `json:"clientID"`
	SharedKey     string `json:"sharedKey"`
	// contains filtered or unexported fields
}

func NewApi

func NewApi(baseUrl, appID, cliID, sharedKey string) *Api

func (Api) Bearer

func (a Api) Bearer() string

func (Api) CancelOrder

func (a Api) CancelOrder(orderID string) error

CancelOrder cancel trading order

func (Api) GetActiveOrdersV3

func (a Api) GetActiveOrdersV3() (OrdersV3, error)

GetActiveOrdersV3 return the list of active trading orders

func (Api) GetOrder

func (a Api) GetOrder(orderID string) (*OrderV3, error)

func (Api) GetOrdersByLimitV3

func (a Api) GetOrdersByLimitV3(limit int, accountID string) (OrdersV3, error)

func (Api) GetUserAccounts

func (a Api) GetUserAccounts() (*UserAccounts, error)

func (Api) Jwt

func (a Api) Jwt() string

func (Api) PlaceOrderV3

func (a Api) PlaceOrderV3(req *OrderSentTypeV3) ([]OrderV3, error)

func (Api) ReplaceOrder

func (a Api) ReplaceOrder(orderID string, req ReplaceOrderPayload) (*OrderV3, error)

type ApiMock

type ApiMock struct {
	CancelOrderFunc        func(orderID string) error
	GetOrderFunc           func(orderID string) (*OrderV3, error)
	PlaceOrderV3Func       func(req *OrderSentTypeV3) ([]OrderV3, error)
	ReplaceOrderFunc       func(orderID string, req ReplaceOrderPayload) (*OrderV3, error)
	GetOrdersByLimitV3Func func(limit int, accountID string) ([]OrderV3, error)
	GetActiveOrdersV3Func  func() (OrdersV3, error)
	TotalCalls             int
	TotalPlaceOrderV3      int
	// contains filtered or unexported fields
}

func NewMock

func NewMock(ordersList []OrderV3) *ApiMock

func (*ApiMock) CancelOrder

func (a *ApiMock) CancelOrder(orderID string) error

func (*ApiMock) GetActiveOrdersV3

func (a *ApiMock) GetActiveOrdersV3() (OrdersV3, error)

func (*ApiMock) GetOrder

func (a *ApiMock) GetOrder(orderID string) (*OrderV3, error)

func (*ApiMock) GetOrdersByLimitV3

func (a *ApiMock) GetOrdersByLimitV3(limit int, accountID string) (OrdersV3, error)

func (*ApiMock) PlaceOrderV3

func (a *ApiMock) PlaceOrderV3(req *OrderSentTypeV3) ([]OrderV3, error)

func (*ApiMock) ReplaceOrder

func (a *ApiMock) ReplaceOrder(orderID string, req ReplaceOrderPayload) (*OrderV3, error)

type CancelOrderPayload

type CancelOrderPayload struct {
	Action string `json:"action"`
}

type ErrorResponse

type ErrorResponse struct {
	Message string
}

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

type Iface

type Iface interface {
	CancelOrder(orderID string) error
	GetOrder(orderID string) (*OrderV3, error)
	PlaceOrderV3(req *OrderSentTypeV3) ([]OrderV3, error)
	ReplaceOrder(orderID string, req ReplaceOrderPayload) (*OrderV3, error)
	GetActiveOrdersV3() (OrdersV3, error)
	GetOrdersByLimitV3(limit int, accountID string) (OrdersV3, error)
}

type OrderFill

type OrderFill struct {
	Quantity string `json:"quantity"`
	Price    string `json:"price"`
	Time     string `json:"timestamp"`
	Position int    `json:"position"`
}

type OrderParameters

type OrderParameters struct {
	Side           string `json:"side"`
	Duration       string `json:"duration"`
	Quantity       string `json:"quantity"`
	Instrument     string `json:"instrument"`
	SymbolId       string `json:"symbolId"`
	OrderType      string `json:"orderType"`
	OcoGroup       string `json:"ocoGroup"`
	IfDoneParentID string `json:"ifDoneParentId"`
	LimitPrice     string `json:"limitPrice"`
	StopPrice      string `json:"stopPrice"`
	PriceDistance  string `json:"priceDistance"`
	PartQuantity   string `json:"partQuantity"`
	PlaceInterval  string `json:"placeInterval"`
}

type OrderSentTypeV3

type OrderSentTypeV3 struct {
	AccountID      string  `json:"accountId"`
	Instrument     string  `json:"instrument"`
	Side           string  `json:"side"`
	Quantity       string  `json:"quantity"`
	Duration       string  `json:"duration"`
	ClientTag      string  `json:"clientTag,omitempty"`
	OcoGroup       string  `json:"ocoGroup,omitempty"`
	LimitPrice     string  `json:"limitPrice,omitempty"`
	IfDoneParentID string  `json:"ifDoneParentId,omitempty"`
	OrderType      string  `json:"orderType"`
	TakeProfit     *string `json:"takeProfit,omitempty"`
	StopLoss       *string `json:"stopLoss,omitempty"`
	StopPrice      *string `json:"stopPrice,omitempty"`
	SymbolID       string  `json:"symbolId"`
}

type OrderState

type OrderState struct {
	Fills []OrderFill `json:"fills"`

	Status     Status `json:"status"`
	LastUpdate string `json:"lastUpdate"`
}

type OrderV3

type OrderV3 struct {
	OrderState      OrderState      `json:"orderState"`
	OrderParameters OrderParameters `json:"orderParameters"`

	OrderID               string `json:"orderId"`
	PlaceTime             string `json:"placeTime"`
	AccountID             string `json:"accountId"`
	ClientTag             string `json:"clientTag"`
	CurrentModificationID string `json:"currentModificationId"`
	ExanteAccount         string `json:"exanteAccount"`
	Username              string `json:"username"`
}

OrderV3 model

type OrdersV3

type OrdersV3 []OrderV3

OrdersV3 model

type ReplaceOrderParameters

type ReplaceOrderParameters struct {
	Quantity      string `json:"quantity,omitempty"`
	LimitPrice    string `json:"limitPrice,omitempty"`
	StopPrice     string `json:"stopPrice,omitempty"`
	PriceDistance string `json:"priceDistance,omitempty"`
}

type ReplaceOrderPayload

type ReplaceOrderPayload struct {
	Action     string                 `json:"action"`
	Parameters ReplaceOrderParameters `json:"parameters,omitempty"`
}

ReplaceOrderPayload method optional payload

type ReplaceOrderResponse

type ReplaceOrderResponse struct {
	OrderId string
}

type Status

type Status string
const (
	PlacingStatus   Status = "placing"
	WorkingStatus   Status = "working"
	CancelledStatus Status = "cancelled"
	PendingStatus   Status = "pending"
	FilledStatus    Status = "filled"
	RejectedStatus  Status = "rejected"
)

type UserAccount

type UserAccount struct {
	Status    string `json:"status"`
	AccountID string `json:"accountId"`
}

type UserAccounts

type UserAccounts []UserAccount

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL