diff --git a/README.md b/README.md index 32d1c4e..165ed70 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,14 @@ [![Go Reference](https://pkg.go.dev/badge/github.com/ksysoev/deriv-api.svg)](https://pkg.go.dev/github.com/ksysoev/deriv-api) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) -This is unofficial library for working with [Deriv API](https://api.deriv.com) + +**This is unofficial library for working with [Deriv API](https://api.deriv.com)** + +DerivAPI is a Go package that provides a client for the Deriv API. It allows you to connect to the Deriv API and make requests to retrieve data and perform actions on your or your client's Deriv account. ## Installation -To install deriv-api, use `go get`: +To use DerivAPI in your Go project, you can install it using go get: ``` go get github.com/ksysoev/deriv-api @@ -19,7 +22,9 @@ go get github.com/ksysoev/deriv-api ## Usage -### Subscribing on tick stream +### Tick stream + +Here's an example of how to use DerivAPI to connect to the Deriv API and subscribe on market data updates: ```golang import ( @@ -27,6 +32,7 @@ import ( "log" "github.com/ksysoev/deriv-api" + "github.com/ksysoev/deriv-api/schema" ) @@ -38,7 +44,7 @@ if err != nil { defer api.Disconnect() -resp, sub, err := api.SubscribeTicks(deriv.Ticks{Ticks: "R_50"}) +resp, sub, err := api.SubscribeTicks(schema.Ticks{Ticks: "R_50"}) if err != nil { log.Fatal(err) @@ -54,11 +60,14 @@ for tick := range sub.Stream { ### Buying a contract +Here's another example of how to use DerivAPI to buy contract and listen for updates for this contract. + ```golang import ( "log" "github.com/ksysoev/deriv-api" + "github.com/ksysoev/deriv-api/schema" ) apiToken := "YOU_API_TOKEN_HERE" @@ -71,7 +80,7 @@ if err != nil { defer api.Disconnect() // First, we need to authorize the connection -reqAuth := deriv.Authorize{Authorize: apiToken} +reqAuth := schema.Authorize{Authorize: apiToken} _, err = api.Authorize(reqAuth) if err != nil { @@ -81,9 +90,9 @@ if err != nil { amount := 100.0 barrier := "+0.001" duration := 5 -basis := deriv.ProposalBasisPayout +basis := schema.ProposalBasisPayout -reqProp := deriv.Proposal{ +reqProp := schema.Proposal{ Proposal: 1, Amount: &amount, Barrier: &barrier, @@ -102,7 +111,7 @@ if err != nil { log.Fatal(err) } -buyReq := deriv.Buy{ +buyReq := schema.Buy{ Buy: proposal.Proposal.Id, Price: 100.0, }