diff --git a/examples/simple_trading_bot/README.md b/examples/simple_trading_bot/README.md new file mode 100644 index 0000000..e6de10b --- /dev/null +++ b/examples/simple_trading_bot/README.md @@ -0,0 +1,13 @@ +# Deriv Binary Options Trading Bot + +This Go script demonstrates how to use the Deriv API to create a simple trading bot for binary options. The script uses the `deriv-api` and `deriv-api/schema` packages to interact with the Deriv API and send requests to create a new proposal and buy a binary option. + +To use this script, you will need to replace the `ApiToken` constant with your own API token. You can obtain an API token by logging in to your Deriv account and generating a new token in the API tokens section. + +The script first creates a new `DerivAPI` instance and authorizes the connection using the provided API token. It then creates a new proposal request with a specified amount, barrier, duration, basis, contract type, currency, and symbol. + +The script then sends the proposal request to the Deriv API and waits for a response. Once a proposal is received, the script creates a new buy request with the proposal ID and a specified price. + +The script then subscribes to the buy request and waits for a response. Once the binary option is bought, the script logs the current spot and the contract result. + +Note that this script is provided as an example and may require modifications to work with your specific environment and use case. It is important to thoroughly test any trading bot before using it with real funds. \ No newline at end of file diff --git a/examples/simple_bot.go b/examples/simple_trading_bot/simple_bot.go similarity index 100% rename from examples/simple_bot.go rename to examples/simple_trading_bot/simple_bot.go diff --git a/examples/tick_history/README.md b/examples/tick_history/README.md new file mode 100644 index 0000000..e69de29 diff --git a/examples/tick_history.go b/examples/tick_history/tick_history.go similarity index 95% rename from examples/tick_history.go rename to examples/tick_history/tick_history.go index ecaa633..0aa64b4 100644 --- a/examples/tick_history.go +++ b/examples/tick_history/tick_history.go @@ -9,7 +9,7 @@ import ( ) func main() { - api, err := deriv.NewDerivAPI("wss://ws.binaryws.com/websockets/v3", 1, "en", "https://www.binary.com") + api, err := deriv.NewDerivAPI("wss://ws.binaryws.com/websockets/v3", 1089, "en", "https://localhost/") if err != nil { log.Fatal(err) diff --git a/examples/tick_stream/README.md b/examples/tick_stream/README.md new file mode 100644 index 0000000..e69de29 diff --git a/examples/tick_stream.go b/examples/tick_stream/tick_stream.go similarity index 90% rename from examples/tick_stream.go rename to examples/tick_stream/tick_stream.go index a718b31..f1fa0a1 100644 --- a/examples/tick_stream.go +++ b/examples/tick_stream/tick_stream.go @@ -9,7 +9,7 @@ import ( ) func main() { - api, err := deriv.NewDerivAPI("wss://ws.binaryws.com/websockets/v3", 1, "en", "https://www.binary.com", deriv.KeepAlive) + api, err := deriv.NewDerivAPI("wss://ws.binaryws.com/websockets/v3", 1089, "en", "https://localhost/", deriv.Debug) if err != nil { log.Fatal(err)