Expand description
Async Rust client for the ProjectX Gateway API.
This crate models ProjectX’s provider-native HTTP contract. It deliberately
owns no trading-engine concepts, runtime, environment loading, or application
state. Applications authenticate explicitly and translate these types at
their own boundary.
Authenticated REST requests use shared rolling-window admission control.
Safe queries wait asynchronously for capacity, while mutations return
Error::LocallyRateLimited before sending when the local budget is full.
Successful list reads return ProviderList so an explicit provider
array, including an authoritative empty one, stays distinguishable from a
success envelope that omits the field or serializes it as JSON null.
§Example
use projectx_client::{Client, Credentials, ProviderList};
let credentials = Credentials::new("user", "api-key")?;
let client = Client::builder(credentials).build()?;
client.authenticate().await?;
match client.search_active_accounts().await? {
ProviderList::Listed(accounts) => {
for account in accounts {
println!("{}", account.name);
}
}
ProviderList::Absent => eprintln!("the provider omitted the account list"),
}Structs§
- Account
- Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
A
ProjectXaccount. - Account
Id - Validated provider account, contract, order, position, symbol, and trade identifiers. Validated provider account, contract, order, position, symbol, and trade identifiers. Validated provider account, contract, order, position, symbol, and trade identifiers. Validated ProjectX account identifier.
- Application
Credentials - API-key and authorized-application credentials and their builder.
API-key and authorized-application credentials and their builder.
API-key and authorized-application credentials and their builder.
ProjectXauthorized-application credentials. - Application
Credentials Builder - API-key and authorized-application credentials and their builder.
API-key and authorized-application credentials and their builder.
API-key and authorized-application credentials and their builder.
Builder for validated
ApplicationCredentials. - Bar
- Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. A historical OHLCV bar.
- Bracket
- Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
ProjectXbracket-leg configuration. - Cancel
Order - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Order cancellation parameters.
- Client
- Authenticated REST client, its builder, and its session-validation guard.
Authenticated REST client, its builder, and its session-validation guard.
Authenticated REST client, its builder, and its session-validation guard.
Authenticated
ProjectXREST client. - Client
Builder - Authenticated REST client, its builder, and its session-validation guard.
Authenticated REST client, its builder, and its session-validation guard.
Authenticated REST client, its builder, and its session-validation guard.
Builder for
Client. - Close
Contract - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Position close parameters.
- Contract
- Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
A
ProjectXfutures contract. - Contract
Id - Validated provider account, contract, order, position, symbol, and trade identifiers. Validated provider account, contract, order, position, symbol, and trade identifiers. Validated provider account, contract, order, position, symbol, and trade identifiers. Validated ProjectX contract identifier.
- Credentials
- API-key and authorized-application credentials and their builder.
API-key and authorized-application credentials and their builder.
API-key and authorized-application credentials and their builder.
ProjectXAPI-key credentials. - Decimal
- Decimal type used for provider prices, money, balances, fees, and P&L.
Decimalrepresents a 128 bit representation of a fixed-precision decimal number. The finite set of values of typeDecimalare of the form m / 10e, where m is an integer such that -296 < m < 296, and e is an integer between 0 and 28 inclusive. - Endpoints
- REST and real-time endpoints for one
ProjectXdeployment. REST and real-time endpoints for oneProjectXdeployment. - History
Request - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Historical-bar request parameters.
- History
Request Builder - Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Builder for a validated
HistoryRequest. - Market
Depth - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Depth-of-market update from the market hub.
- Market
Quote - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Sparse quote update from the market hub.
- Market
Trade - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Trade print from the market hub.
- Modify
Order - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Order modification parameters.
- Modify
Order Builder - Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Builder for a validated
ModifyOrder. - Operation
Response - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Successful response for an operation without a result body.
- Order
- Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
A
ProjectXorder. - OrderId
- Validated provider account, contract, order, position, symbol, and trade identifiers. Validated provider account, contract, order, position, symbol, and trade identifiers. Validated provider account, contract, order, position, symbol, and trade identifiers. Validated ProjectX order identifier.
- Order
Page - Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
One page returned by
Client::query_orders. - Order
Query - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Filtered, paginated order-query parameters.
- Order
Query Builder - Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Builder for a validated
OrderQuery. - Order
Response - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Successful order-placement result.
- Order
Search - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Historical order search parameters.
- Partial
Close Contract - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Partial-position close parameters.
- Place
Order - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Order placement parameters.
- Place
Order Builder - Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Builder for a validated
PlaceOrder. - Position
- Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
A
ProjectXopen position. - Position
Id - Validated provider account, contract, order, position, symbol, and trade identifiers. Validated provider account, contract, order, position, symbol, and trade identifiers. Validated provider account, contract, order, position, symbol, and trade identifiers. Validated ProjectX position identifier.
- Provider
Date - Validated provider timestamps, civil dates, and their parse errors.
Validated provider timestamps, civil dates, and their parse errors.
Validated provider timestamps, civil dates, and their parse errors.
A provider civil date parsed from an ISO-8601
YYYY-MM-DDvalue. - Provider
Date Error - Validated provider timestamps, civil dates, and their parse errors. Validated provider timestamps, civil dates, and their parse errors. Validated provider timestamps, civil dates, and their parse errors. A string was not a valid provider civil date.
- Provider
Error - Client errors, provider rejections, and ambiguous-mutation origins. Client errors, provider rejections, and ambiguous-mutation origins. Client errors, provider rejections, and ambiguous-mutation origins. A provider-declared failed operation.
- Rate
Limit - Rolling-window REST rate-limit kinds, limits, and configuration. Rolling-window REST rate-limit kinds, limits, and configuration. Rolling-window REST rate-limit kinds, limits, and configuration. One rolling-window request limit.
- Rate
Limit Config - Rolling-window REST rate-limit kinds, limits, and configuration.
Rolling-window REST rate-limit kinds, limits, and configuration.
Rolling-window REST rate-limit kinds, limits, and configuration.
Rate limits applied to authenticated
ProjectXREST requests. - Realtime
Client - Real-time hubs, client, session, events, messages, and invocation decoding.
Real-time hubs, client, session, events, messages, and invocation decoding.
Real-time hubs, client, session, events, messages, and invocation decoding.
SignalR-over-WebSocket client for oneProjectXhub. - Realtime
Event Receiver - Real-time hubs, client, session, events, messages, and invocation decoding. Real-time hubs, client, session, events, messages, and invocation decoding. Real-time hubs, client, session, events, messages, and invocation decoding. Single-consumer receiver for real-time events.
- Realtime
Generation - Real-time hubs, client, session, events, messages, and invocation decoding. Real-time hubs, client, session, events, messages, and invocation decoding. Real-time hubs, client, session, events, messages, and invocation decoding. Identity of one ready socket, scoped to its owning real-time client.
- Realtime
Message - Real-time hubs, client, session, events, messages, and invocation decoding. Real-time hubs, client, session, events, messages, and invocation decoding. Real-time hubs, client, session, events, messages, and invocation decoding. An observation attributed to the exact socket that produced it.
- Realtime
Session - Real-time hubs, client, session, events, messages, and invocation decoding. Real-time hubs, client, session, events, messages, and invocation decoding. Real-time hubs, client, session, events, messages, and invocation decoding. Subscription and invocation admission bound to one exact ready socket. This handle cannot stop or reconnect the transport and does not keep its owner alive.
- Search
Contracts - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Contract search parameters.
- Session
Validator - Authenticated REST client, its builder, and its session-validation guard. Authenticated REST client, its builder, and its session-validation guard. Authenticated REST client, its builder, and its session-validation guard. Guard for a periodic token-validation task.
- SignalR
Invocation - Real-time hubs, client, session, events, messages, and invocation decoding.
Real-time hubs, client, session, events, messages, and invocation decoding.
Real-time hubs, client, session, events, messages, and invocation decoding.
A decoded
SignalRinvocation frame. - Symbol
Id - Validated provider account, contract, order, position, symbol, and trade identifiers. Validated provider account, contract, order, position, symbol, and trade identifiers. Validated provider account, contract, order, position, symbol, and trade identifiers. Validated ProjectX symbol identifier.
- Timestamp
- Validated provider timestamps, civil dates, and their parse errors. Validated provider timestamps, civil dates, and their parse errors. Validated provider timestamps, civil dates, and their parse errors. An absolute provider timestamp parsed from an ISO-8601/RFC-3339 value.
- Timestamp
Error - Validated provider timestamps, civil dates, and their parse errors. Validated provider timestamps, civil dates, and their parse errors. Validated provider timestamps, civil dates, and their parse errors. A string was not a valid absolute provider timestamp.
- Trade
- Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
A
ProjectXexecution trade. - TradeId
- Validated provider account, contract, order, position, symbol, and trade identifiers. Validated provider account, contract, order, position, symbol, and trade identifiers. Validated provider account, contract, order, position, symbol, and trade identifiers. Validated ProjectX trade identifier.
- Trade
Query - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Trade search parameters with independently optional timestamp bounds.
- Trade
Query Builder - Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Builder for a validated
TradeQuery. - Trade
Search - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Trade search parameters.
Enums§
- Ambiguity
Origin - Client errors, provider rejections, and ambiguous-mutation origins. Client errors, provider rejections, and ambiguous-mutation origins. Client errors, provider rejections, and ambiguous-mutation origins. The transport-level origin of an ambiguous mutation outcome, when a provider rejection was not decoded.
- BarUnit
- Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Historical-bar aggregation unit.
- Depth
Type - Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
A
ProjectXdepth-of-market update kind. - Error
- Client errors, provider rejections, and ambiguous-mutation origins.
Client errors, provider rejections, and ambiguous-mutation origins.
Client errors, provider rejections, and ambiguous-mutation origins.
Errors returned by the
ProjectXclient. - Hub
- Real-time hubs, client, session, events, messages, and invocation decoding.
Real-time hubs, client, session, events, messages, and invocation decoding.
Real-time hubs, client, session, events, messages, and invocation decoding.
ProjectXreal-time hub. - Order
Sort By - Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Field used to sort an
OrderQueryresult page. - Order
Sort Direction - Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Direction used to sort an
OrderQueryresult page. - Order
Status - Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
A
ProjectXorder lifecycle status. - Order
Type - Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
A
ProjectXorder type. - Position
Type - Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
A
ProjectXposition direction. - Provider
List - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. A provider list field read from a successful response body.
- Rate
Limit Kind - Rolling-window REST rate-limit kinds, limits, and configuration. Rolling-window REST rate-limit kinds, limits, and configuration. Rolling-window REST rate-limit kinds, limits, and configuration. Identifies one provider REST rate-limit budget.
- Realtime
Error - Real-time hubs, client, session, events, messages, and invocation decoding. Real-time hubs, client, session, events, messages, and invocation decoding. Real-time hubs, client, session, events, messages, and invocation decoding. Errors returned by the real-time transport.
- Realtime
Event - Real-time hubs, client, session, events, messages, and invocation decoding.
Real-time hubs, client, session, events, messages, and invocation decoding.
Real-time hubs, client, session, events, messages, and invocation decoding.
Events emitted by a
RealtimeClient. - Request
Validation Error - Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Provider-native request, response, order, position, trade, and market-data models. Validation failures while constructing a provider request.
- Side
- Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
A
ProjectXorder side. - Trade
LogType - Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
Provider-native request, response, order, position, trade, and market-data models.
A
ProjectXmarket-trade aggressor classification.