aboutsummaryrefslogtreecommitdiff
path: root/examples/info/main.go
blob: 260ecba3d710f751da12a27ed53b351f04f6bf6f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package main

import (
	"context"
	"fmt"
	"log"
	"time"

	"go.popov.link/metatrader4/mt4"
)

func main() {
	client := mt4.NewClient("127.0.0.1", 443,
		mt4.WithDialTimeout(3*time.Second),
		mt4.WithReadTimeout(5*time.Second),
		mt4.WithWriteTimeout(5*time.Second),
	)
	ctx := context.Background()
	// INFO does not require parameters
	resp, err := client.Execute(ctx, "INFO", nil)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(resp)
}