aboutsummaryrefslogtreecommitdiff
path: root/examples/info/main.go
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2025-06-04 11:08:19 +0300
committerGitHub <noreply@github.com>2025-06-04 11:08:19 +0300
commit7240595478fedec02e9e47c704976cf56a66d3e8 (patch)
tree300165d4ecf00fed03d33b36863370384cbdc7ce /examples/info/main.go
parent76dc648f33a9f96e68d5c9000032c2b986bd5a3d (diff)
downloadgo-metatrader4-7240595478fedec02e9e47c704976cf56a66d3e8.tar.xz
go-metatrader4-7240595478fedec02e9e47c704976cf56a66d3e8.zip
First version
Diffstat (limited to 'examples/info/main.go')
-rw-r--r--examples/info/main.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/info/main.go b/examples/info/main.go
new file mode 100644
index 0000000..260ecba
--- /dev/null
+++ b/examples/info/main.go
@@ -0,0 +1,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)
+}