{"id":21602330,"url":"https://github.com/cryptomkt/cryptomkt-go","last_synced_at":"2025-04-11T02:32:43.764Z","repository":{"id":45291582,"uuid":"239539742","full_name":"cryptomkt/cryptomkt-go","owner":"cryptomkt","description":"CryptoMarket GoLang SDK","archived":false,"fork":false,"pushed_at":"2025-01-08T20:25:51.000Z","size":13234,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-24T23:51:34.721Z","etag":null,"topics":["bitcoin","cryptocurrency","cryptomkt","eos","ether","ethereum","exchange","go","stellar-lumens"],"latest_commit_sha":null,"homepage":"https://developers.cryptomkt.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cryptomkt.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}},"created_at":"2020-02-10T15:05:25.000Z","updated_at":"2025-01-08T20:24:52.000Z","dependencies_parsed_at":"2024-05-06T15:12:07.090Z","dependency_job_id":"48f4a3f6-0246-475f-b099-ba76bf9d6723","html_url":"https://github.com/cryptomkt/cryptomkt-go","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptomkt%2Fcryptomkt-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptomkt%2Fcryptomkt-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptomkt%2Fcryptomkt-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptomkt%2Fcryptomkt-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cryptomkt","download_url":"https://codeload.github.com/cryptomkt/cryptomkt-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248329711,"owners_count":21085589,"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","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":["bitcoin","cryptocurrency","cryptomkt","eos","ether","ethereum","exchange","go","stellar-lumens"],"created_at":"2024-11-24T19:12:50.913Z","updated_at":"2025-04-11T02:32:43.736Z","avatar_url":"https://github.com/cryptomkt.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CryptoMarket-go\n\n[main page](https://www.cryptomkt.com/)\n\n[sign up in CryptoMarket](https://www.cryptomkt.com/account/register).\n\n# Installation\n\nTo install the Cryptomarket client\n\n```\n go get github.com/cryptomkt/cryptomkt-go/v3\n```\n\n# Documentation\n\nThis sdk makes use of the [api version 3](https://api.exchange.cryptomkt.com/#about-cryptomarket-api) of cryptomarket\n\n# Quick Start\n\n## rest client\n\n```go\nimport (\n\t\"context\"\n\n  \"github.com/cryptomkt/cryptomkt-go/v3/args\"\n  \"github.com/cryptomkt/cryptomkt-go/v3/rest\"\n)\n\n// instance a client\nlet apiKey=\"AB32B3201\"\nlet apiSecret=\"21b12401\"\n// default window\nlet window = 0\n// or some other window in miliseconds\nwindow = 25000\n\nclient := rest.NewClient(apiKey, apiSecret, window)\nctx := context.Background()\n\n// get currencies\ncurrencies, err := client.GetCurrencies(ctx)\n\n// get order books\norderBook, err := client.GetOrderBook(ctx, args.Symbol(\"EOSETH\"))\n\n// get your wallet balances\naccountBalanceList, err := client.GetWalletBalances(ctx)\n\n// get your trading balances\ntradingBalanceList, err := client.GetSpotTradingBalances(ctx)\n\n// move balance from wallet to spot trading\nresult, err := client.TransferMoneyFromAccountBalanceToTradingBalance(\n  ctx,\n  args.Currency(\"ETH\"),\n  args.Amount(\"3.2\"),\n  args.Source(args.AccountWallet),\n  args.Destination(args.AccountSpot),\n)\n\n// get your active orders\nordersList, _ := client.GetAllActiveSpotOrders(ctx, args.Symbol(\"EOSETH\"))\n\n// create a new order\norder, err := client.CreateSpotOrder(ctx, args.Symbol(\"EOSETH\"), args.Side(args.SideTypeBuy), args.Quantity(\"10\"), args.Price(\"10\"))\n```\n\n## websocket clients\n\nthere are three websocket clients, `MarketDataClient`, the `SpotTradingClient` and the `WalletManagementClient`. The `MarketDataClient` is public, while the others require authentication to be used.\n\nwebsocket subscriptions make use of notification channels. To close the notification channel of a subscription, remember to call the corrensponding Unsubscription.\n\n### MarketDataClient\n\nUnsubscription for the MarketDataClient are called from the subscription structure, as seen in the examples. Keep in mind that this stop the client from processing the messages, but the server will continue to send them. To completely stop recieving messages is recomended to close the MarketDataClient.\n\n```go\n// instance a client\nclient, err := NewMarketDataClient()\n// close the client\ndefer client.Close()\n// subscribe to public trades\nsubscription, err := client.SubscribeToTrades(\n  args.Symbols([]string{\"EOSETH\", \"ETHBTC\"}),\n  args.Limit(10),\n)\nsubscribedSymbols := subscription.Symbols\ngo func() {\n  for notification := range subscription.NotificationCh {\n      notificationType := notification.NotificationType\n      if notificationType == args.NotificationSnapshot {\n        fmt.Println('is a snapshot')\n      }\n      if notificationType == args.NotificationUpdate {\n        fmt.Println('is an update')\n      }\n      for _, tradeList := range notification.Data {\n        for _, trade := range tradeList {\n          fmt.Println(trade)\n      }\n    }\n  }\n}()\n// unsubscribe\nUnsubscribeTo(subscription.NotificationChannel)\n\n// subscribe to symbol tickers\nsubscription, err = client.SubscribeToTicker(\n  args.Symbols([]string{\"EOSETH\"}),\n  args.TickerSpeed(args.TickerSpeed1s),\n)\ngo func() {\n  for notification := range subscription.NotificationCh {\n    notificationType := notification.NotificationType\n    if notificationType == args.NotificationData {\n      fmt.Println('is always a data notification')\n    }\n    fmt.Println(\"tickers\")\n    for symbol, ticker := range notification.Data {\n      fmt.Println(\"[\"+symbol+\"]=\"+ ticker)\n    }\n  }\n}()\n// unsubscribe\nUnsubscribeTo(subscription.NotificationChannel)\n```\n\n### SpotTradingClient\n\n```go\n// instance a client with default window of 10 seconds\nclient, err := NewSpotTradingClient(APIKey, APISecret, 0)\n// close the client\ndefer client.Close()\n\n// subscribe to order reports\nnotificationCh, err := client.SubscribeToReports()\ngo func() {\n  for notification := range notificationCh {\n    for _, report := range notification.Data {\n      fmt.Println(report)\n    }\n  }\n}()\n// unsubscribe from order reports\nclient.UnsubscribeToReports()\n\nclientOrderID := fmt.Sprint(time.Now().Unix())\n\n// create an order\nclient.CreateSpotOrder(\n  context.Background(),\n  args.Symbol(\"EOSETH\"),\n  args.Side(args.SideSell),\n  args.Price(\"1000\"),\n  args.Quantity(\"0.01\"),\n  args.ClientOrderID(clientOrderID),\n)\n\n// candel an order\nclient.CancelSpotOrder(\n  context.Background(),\n  args.ClientOrderID(clientOrderID),\n)\n\n```\n\n### WalletManagementClient\n\n```go\n// instance a client with 20 seconds of window\nclient, err := NewWalletManagementClient(APIKey, APISecret, 20_000)\n// close the client\ndefer client.Close()\n\n// subscribe to wallet transactions\nnotificationCh, err := client.SubscribeToTransactions()\ngo func() {\n  for notification := range notificationCh {\n    transaction := notification.Data\n    fmt.Println(transaction)\n  }\n}()\n\n// unsubscribe from wallet transactions\nerr = client.UnsubscribeToTransactions()\n\n// get wallet balances\nbalances, err := client.GetWalletBalances(context.Background())\nfor _, balance := range balances {\n  fmt.Println(balance)\n}\n\n// transfer assets from wallet account and spot account\nrestClient.TransferBetweenWalletAndExchange(\n  context.Background(),\n  args.Amount(\"0.2\"),\n  args.Currency(\"EOS\"),\n  args.Source(args.AccountWallet),\n  args.Destination(args.AccountSpot),\n)\n```\n\n## arguments and constants of interest\n\nall the arguments for the clients are in the args package, as well as the custom types for the arguments. check the package documentation, and the method documentation of the clients for more info.\n\n# Checkout our other SDKs\n\n[python sdk](https://github.com/cryptomkt/cryptomkt-python)\n\n[nodejs sdk](https://github.com/cryptomkt/cryptomkt-node)\n\n[java sdk](https://github.com/cryptomkt/cryptomkt-java)\n\n[ruby sdk](https://github.com/cryptomkt/cryptomkt-ruby)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryptomkt%2Fcryptomkt-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcryptomkt%2Fcryptomkt-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryptomkt%2Fcryptomkt-go/lists"}