Versions in this module Expand all Collapse all v0 v0.0.9 Aug 4, 2026 v0.0.8 May 24, 2026 v0.0.7 May 6, 2026 Changes in this version type RealtimeService + func (r *RealtimeService) Close() v0.0.6 May 3, 2026 Changes in this version + const CHAN_SIZE v0.0.5 May 2, 2026 Changes in this version + func GatewayDepthCSVHeader() string + func GatewayQuoteCSVHeader() string + func GatewayTradeCSVHeader() string + func GatewayUserAccountCSVHeader() string + func GatewayUserOrderCSVHeader() string + func GatewayUserPositionCSVHeader() string + func GatewayUserTradeCSVHeader() string + type GatewayDepth struct + CurrentVolume int64 + Price float64 + Timestamp string + Type int + Volume int64 + func (d GatewayDepth) String() string + func (d GatewayDepth) ToCSVRow() string + type GatewayQuote struct + BestAsk float64 + BestBid float64 + Change float64 + ChangePercent float64 + High float64 + LastPrice float64 + LastUpdated string + Low float64 + Open float64 + Symbol string + SymbolName string + Timestamp string + Volume int64 + func (q GatewayQuote) String() string + func (q GatewayQuote) ToCSVRow() string type GatewayTrade + func (t GatewayTrade) String() string + func (t GatewayTrade) ToCSVRow() string + type GatewayUserAccount struct + Balance float64 + CanTrade bool + Id int + IsVisible bool + Name string + Simulated bool + func (a GatewayUserAccount) String() string + func (a GatewayUserAccount) ToCSVRow() string + type GatewayUserOrder struct + AccountId int + ContractId string + CreationTimestamp string + CustomTag string + FillVolume int + FilledPrice float64 + Id int + LimitPrice float64 + Side int + Size int + Status int + StopPrice float64 + SymbolId string + Type int + UpdateTimestamp string + func (o GatewayUserOrder) String() string + func (o GatewayUserOrder) ToCSVRow() string + type GatewayUserPosition struct + AccountId int + AveragePrice float64 + ContractId string + CreationTimestamp string + Id int + Size int + Type int + func (p GatewayUserPosition) String() string + func (p GatewayUserPosition) ToCSVRow() string + type GatewayUserTrade struct + AccountId int + ContractId string + CreationTimestamp string + Fees float64 + Id int + OrderId int + Price float64 + ProfitAndLoss float64 + Side int + Size int + Voided bool + func (t GatewayUserTrade) String() string + func (t GatewayUserTrade) ToCSVRow() string type RealtimeService + Quote chan GatewayQuote + Trade chan GatewayTrade v0.0.4 Apr 26, 2026 Changes in this version + const Ask + const Bid + const Https + const RecordSep + const Wss + func GetWsConn(negotiateUrl, wsUrl, token string) (net.Conn, error) + func ReadFullText(conn net.Conn) ([]byte, error) + func WriteTextFrame(conn net.Conn, payload []byte) error + type APIError struct + Body string + StatusCode int + func (e *APIError) Error() string + type Account struct + Balance float64 + CanTrade bool + Id int + IsVisible bool + Name string + type AccountResponse struct + Accounts []Account + ErrorCode int + ErrorMessage string + Success bool + type AccountSearchRequest struct + OnlyActiveAccounts bool + type AccountService struct + func (s *AccountService) Search(ctx context.Context, req AccountSearchRequest) ([]Account, error) + type AvailableContractRequest struct + Live bool + type AvailableContractResponse struct + Contracts []Contract + ErrorCode int + ErrorMessage string + Success bool + type Bar struct + Close float64 + High float64 + Low float64 + Open float64 + Timestamp string + Volume float64 + type BarHistoryRequest struct + ContractId string + EndTime string + IncludePartialBar bool + Limit int + Live bool + StartTime string + Unit int + UnitNumber int + type BasicOrderResponse struct + ErrorCode int + ErrorMessage string + Success bool + type BasicPositionResponse struct + ErrorCode int + ErrorMessage string + Success bool + type Bracket struct + Ticks int + Type int + type CancelOrderRequest struct + AccountId int + OrderId int + type CloseContractRequest struct + AccountId int + ContractId string + type Contract struct + ActiveContract bool + Description string + Id string + Name string + SymbolId string + TickSize float64 + TickValue float64 + type GatewayTrade struct + Price float64 + SymbolId string + Timestamp string + Type int + Volume int64 + type HistoryResponse struct + Bars []Bar + ErrorCode int + ErrorMessage string + Success bool + type MarketService struct + func (s *MarketService) AvailableContracts(ctx context.Context, req AvailableContractRequest) ([]Contract, error) + func (s *MarketService) History(ctx context.Context, req BarHistoryRequest) ([]Bar, error) + func (s *MarketService) SearchContractById(ctx context.Context, req SearchContractByIdRequest) ([]Contract, error) + func (s *MarketService) SearchContracts(ctx context.Context, req SearchContractRequest) ([]Contract, error) + type ModifyOrderRequest struct + AccountId int + LimitPrice float64 + OrderId int + Size int + StopPrice float64 + TrailPrice float64 + type OpenOrder struct + AccountID int64 + ContractID string + CreationTimestamp time.Time + FilledPrice *float64 + ID int64 + LimitPrice *float64 + Side int + Size int + Status int + StopPrice *float64 + Type int + UpdateTimestamp time.Time + type OpenOrderSearchRequest struct + AccountId int + type OpenOrderSearchResponse struct + ErrorCode int + ErrorMessage string + Orders []OpenOrder + Success bool + type Order struct + AccountID int64 + ContractID string + CreationTimestamp time.Time + CustomTag *string + FillVolume int + FilledPrice *float64 + ID int64 + LimitPrice *float64 + Side int + Size int + Status int + StopPrice *float64 + SymbolID string + Type int + UpdateTimestamp time.Time + type OrderSearchRequest struct + AccountId int + EndTimestamp string + StartTimestamp string + type OrderSearchResponse struct + ErrorCode int + ErrorMessage string + Orders []Order + Success bool + type OrderService struct + func (s *OrderService) CancelOrder(ctx context.Context, req CancelOrderRequest) (bool, error) + func (s *OrderService) ModifyOrder(ctx context.Context, req ModifyOrderRequest) (bool, error) + func (s *OrderService) OpenOrderSearch(ctx context.Context, req OpenOrderSearchRequest) ([]OpenOrder, error) + func (s *OrderService) OrderSearch(ctx context.Context, req OrderSearchRequest) ([]Order, error) + func (s *OrderService) PlaceOrder(ctx context.Context, req PlaceOrderRequest) (int, error) + type PartialCloseContractRequest struct + AccountId int + ContractId string + Size int + type PlaceOrderRequest struct + AccountId int + ContractId string + CustomTag string + LimitPrice float64 + Side int + Size int + StopLossBracket Bracket + StopPrice float64 + TakeProfitBracket Bracket + TrailPrice float64 + Type int + type PlaceOrderResponse struct + ErrorCode int + ErrorMessage string + OrderId int + Success bool + type PositionService struct + func (p *PositionService) CloseContract(ctx context.Context, req CloseContractRequest) (bool, error) + func (p *PositionService) PartialCloseContract(ctx context.Context, req PartialCloseContractRequest) (bool, error) + func (p *PositionService) SearchOpenContract(ctx context.Context, req SearchOpenContractRequest) (bool, error) + type ProjectXClient struct + Accounts *AccountService + Markets *MarketService + Orders *OrderService + Realtime *RealtimeService + Trades *TradeService + func NewProjectXClient(baseUrl, wsUrl, username, apiKey string) *ProjectXClient + func (c *ProjectXClient) Post(ctx context.Context, endpoint string, reqBody any, respBody any) error + func (c *ProjectXClient) PostNoAuth(ctx context.Context, endpoint string, reqBody any, respBody any) error + type RealtimeService struct + Depth chan json.RawMessage + Quotes chan json.RawMessage + Trades chan json.RawMessage + UserAccount chan json.RawMessage + UserOrder chan json.RawMessage + UserPosition chan json.RawMessage + UserTrade chan json.RawMessage + func NewRealtimeService(c *ProjectXClient) *RealtimeService + func (r *RealtimeService) Connect(ctx context.Context) error + func (r *RealtimeService) DepthStream() <-chan json.RawMessage + func (r *RealtimeService) QuotesStream() <-chan json.RawMessage + func (r *RealtimeService) SubscribeAccounts(contractId string) error + func (r *RealtimeService) SubscribeContractMarketDepth(contractId string) error + func (r *RealtimeService) SubscribeContractQuotes(contractId string) error + func (r *RealtimeService) SubscribeContractTrades(contractId string) error + func (r *RealtimeService) SubscribeOrders(contractId string) error + func (r *RealtimeService) SubscribePositions(contractId string) error + func (r *RealtimeService) SubscribeTrades(contractId string) error + func (r *RealtimeService) TradesStream() <-chan json.RawMessage + func (r *RealtimeService) UserAccountStream() <-chan json.RawMessage + func (r *RealtimeService) UserOrdersStream() <-chan json.RawMessage + func (r *RealtimeService) UserPositionStream() <-chan json.RawMessage + func (r *RealtimeService) UserTradeStream() <-chan json.RawMessage + type SearchContractByIdRequest struct + ContractId string + type SearchContractRequest struct + Live bool + SearchText string + type SearchOpenContractRequest struct + AccountId int + type SubscribeMsg struct + Arguments []string + Target string + Type int + type Trade struct + AccountId int + ContractId string + CreationTimestamp string + Fees float64 + Id int + OrderId int + Price float64 + ProfitAndLoss float64 + Side int + Size int + Voided bool + type TradeSearchRequest struct + AccountId int + EndTimestamp string + StartTimestamp string + type TradeSearchResponse struct + ErrorCode int + ErrorMessage string + Success bool + Trades []Trade + type TradeService struct + func (s *TradeService) Search(ctx context.Context, req TradeSearchRequest) ([]Trade, error) + type WebSocketHandshakeResponse struct + AvailableTransports []interface{} + ConnectionId string + ConnectionToken string + NegotiateVersion int