Skip to content

Environments

Describes github.com/stxapp/stx-go v0.3.1, the current release.

The exchanges, their hosts and which one to start with are listed on Environments. In the SDK, pick one with stx.WithEnvironment, or with a region and env (as an option, as STX_REGION and STX_ENV, or in a credentials profile):

Exchange Option region env
STX US demo stx.WithEnvironment(stx.USDemo) us demo
STX Ontario demo stx.WithEnvironment(stx.OntarioDemo) ontario demo
STX Ontario stx.WithEnvironment(stx.OntarioProduction) ontario production
client, err := stx.New(stx.WithEnvironment(stx.USDemo), stx.WithKey("3f1c9a52-7d4e-4b8a-9c21-5e6f7a8b9c0d", "~/.stx/us-demo.pem"))
if err != nil {
log.Fatal(err)
}
fmt.Println(client.BaseURL(), client.SocketURL())
// https://demo.stxapp.io wss://demo.stxapp.io/socket/websocket
// The same exchange, by region and env, or by name:
same, err := stx.New(stx.WithRegion("us", "demo"))
byName, err := stx.New(stx.WithEnvironmentName("us-demo"))

stx.Environments() lists every published environment, and stx.EnvironmentNamed("ontario-demo") looks one up by name. Environment.RealMoney is true for production exchanges.

An API key works on one exchange only, so keep one credentials profile per exchange and switch with stx.WithProfile.

To reach any other host, such as a local server, pass stx.WithHost("http://localhost:4000") (or set STX_HOST). The URL’s scheme is kept for both HTTP and the socket. stx.WithInsecureSkipVerify() turns off TLS verification, for a local server with a self-signed certificate only.

STX is operated by XV Exchange, LLC, a Designated Contract Market regulated by the U.S. Commodity Futures Trading Commission (CFTC). Contracts traded on STX are cleared by XV Clearing, LLC, a CFTC-registered Derivatives Clearing Organization. Trading involves substantial risk of loss and may not be appropriate for everyone. Members risk losing the cost to enter any transaction, including fees. Consider whether trading is appropriate for you in light of your experience and financial resources. Nothing on this site is investment advice or a recommendation to trade. Past performance is not indicative of future results.

© 2026 STX. All rights reserved.llms.txtllms-full.txtView as Markdown
Docs version v1.10.5