{"id":24199751,"url":"https://github.com/ksysoev/deriv-api","last_synced_at":"2025-09-21T23:32:16.203Z","repository":{"id":144428907,"uuid":"614350637","full_name":"ksysoev/deriv-api","owner":"ksysoev","description":"Golang Deriv API client","archived":false,"fork":false,"pushed_at":"2025-09-10T08:04:44.000Z","size":1845,"stargazers_count":17,"open_issues_count":3,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-10T11:50:23.526Z","etag":null,"topics":["api","deriv","trading"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ksysoev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-03-15T12:14:11.000Z","updated_at":"2025-09-10T08:04:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"373850fa-f777-435d-b851-239f36c4d88b","html_url":"https://github.com/ksysoev/deriv-api","commit_stats":null,"previous_names":[],"tags_count":62,"template":false,"template_full_name":null,"purl":"pkg:github/ksysoev/deriv-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksysoev%2Fderiv-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksysoev%2Fderiv-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksysoev%2Fderiv-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksysoev%2Fderiv-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ksysoev","download_url":"https://codeload.github.com/ksysoev/deriv-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksysoev%2Fderiv-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274847298,"owners_count":25360978,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","deriv","trading"],"created_at":"2025-01-13T20:38:49.768Z","updated_at":"2025-09-21T23:32:15.707Z","avatar_url":"https://github.com/ksysoev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deriv Api Client\n\n[![Tests](https://github.com/ksysoev/deriv-api/actions/workflows/main.yml/badge.svg)](https://github.com/ksysoev/deriv-api/actions/workflows/main.yml)\n[![codecov](https://codecov.io/gh/ksysoev/deriv-api/branch/main/graph/badge.svg?token=V89HZZ5L9H)](https://codecov.io/gh/ksysoev/deriv-api)\n[![Schema Updated](https://github.com/ksysoev/deriv-api/actions/workflows/schema.yml/badge.svg)](https://github.com/ksysoev/deriv-api/actions/workflows/schema.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/ksysoev/deriv-api)](https://goreportcard.com/report/github.com/ksysoev/deriv-api)\n[![Go Reference](https://pkg.go.dev/badge/github.com/ksysoev/deriv-api.svg)](https://pkg.go.dev/github.com/ksysoev/deriv-api)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n\n**This is unofficial library for working with [Deriv API](https://api.deriv.com)**\n\nDerivAPI 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.\n\n## Installation\n\nTo use DerivAPI in your Go project, you can install it using go get:\n\n```\ngo get github.com/ksysoev/deriv-api\n```\n\n## Usage\n\n### Tick stream\n\nHere's an example of how to use DerivAPI to connect to the Deriv API and subscribe on market data updates:\n\n```golang\nimport (\n    \"context\"\n    \"fmt\"\n    \"log\"\n    \"time\"\n\n    \"github.com/ksysoev/deriv-api\"\n    \"github.com/ksysoev/deriv-api/schema\"\n)\n\n\napi, err := deriv.NewDerivAPI(\"wss://ws.binaryws.com/websockets/v3\", 1, \"en\", \"http://example.com/\")\n\nif err != nil {\n    log.Fatal(err)\n}\n\ndefer api.Disconnect()\n\nctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\ndefer cancel()\n\nresp, sub, err := api.SubscribeTicks(ctx, schema.Ticks{Ticks: \"R_50\"})\n\nif err != nil {\n    log.Fatal(err)\n    return\n}\n\nfmt.Println(\"Symbol: \", *resp.Tick.Symbol, \"Quote: \", *resp.Tick.Quote)\n\nfor tick := range sub.Stream {\n    fmt.Println(\"Symbol: \", *tick.Tick.Symbol, \"Quote: \", *tick.Tick.Quote)\n}\n```\n\n### Buying a contract\n\nHere's another example of how to use DerivAPI to buy contract and listen for updates for this contract.\n\n```golang\nimport (\n    \"context\"\n    \"log\"\n    \"time\"\n\n    \"github.com/ksysoev/deriv-api\"\n    \"github.com/ksysoev/deriv-api/schema\"\n)\n\napiToken := \"YOU_API_TOKEN_HERE\"\napi, err := deriv.NewDerivAPI(\"wss://ws.binaryws.com/websockets/v3\", 1, \"en\", \"https://www.binary.com\")\n\nif err != nil {\n    log.Fatal(err)\n}\n\ndefer api.Disconnect()\n\nctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\ndefer cancel()\n\n// First, we need to authorize the connection\nreqAuth := schema.Authorize{Authorize: apiToken}\n_, err = api.Authorize(ctx, reqAuth)\n\nif err != nil {\n    log.Fatal(err)\n}\n\namount := 100.0\nbarrier := \"+0.001\"\nduration := 5\nbasis := schema.ProposalBasisPayout\n\nreqProp := schema.Proposal{\n    Proposal:     1,\n    Amount:       \u0026amount,\n    Barrier:      \u0026barrier,\n    Basis:        \u0026basis,\n    ContractType: deriv.ProposalContractTypeCALL,\n    Currency:     \"USD\",\n    Duration:     \u0026duration,\n    DurationUnit: deriv.ProposalDurationUnitT,\n    Symbol:       \"R_50\",\n}\n\n// Send a proposal request\nproposal, err := api.Proposal(ctx, reqProp)\n\nif err != nil {\n    log.Fatal(err)\n}\n\nbuyReq := schema.Buy{\n    Buy:   proposal.Proposal.Id,\n    Price: 100.0,\n}\n\n_, buySub, err := api.SubscribeBuy(context.Background(), buyReq)\n\nif err != nil {\n    log.Fatal(err)\n}\n\nfor proposalOpenContract := range buySub.Stream {\n    log.Println(\"Current Spot: \", *proposalOpenContract.ProposalOpenContract.CurrentSpot)\n    if *proposalOpenContract.ProposalOpenContract.IsSold == 1 {\n        log.Println(\"Contract Result: \", proposalOpenContract.ProposalOpenContract.Status.Value)\n        buySub.Forget()\n        break\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksysoev%2Fderiv-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fksysoev%2Fderiv-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksysoev%2Fderiv-api/lists"}