Go
Standard library only for REST; github.com/gorilla/websocket for streaming.
All examples assume the EA is running on the same computer with default ports. Order examples are for demo accounts.
Get a price
Section titled “Get a price”package main
import ( "encoding/json" "fmt" "net/http")
func main() { resp, err := http.Get("http://127.0.0.1:81/v1/quote?symbol=EURUSD") if err != nil { panic(err) } defer resp.Body.Close() var q map[string]any json.NewDecoder(resp.Body).Decode(&q) fmt.Println(q["SYMBOL"], q["BID"], q["ASK"])}Send an order (demo)
Section titled “Send an order (demo)”resp, _ := http.Post( "http://127.0.0.1:81/v1/order?symbol=EURUSD&volume=0.01&type=ORDER_TYPE_BUY", "application/json", nil)var r map[string]anyjson.NewDecoder(resp.Body).Decode(&r)fmt.Println(r["RETCODE"], r["ORDER"])