{"id":22123182,"url":"https://github.com/penn201500/wooapi","last_synced_at":"2025-03-24T07:28:15.054Z","repository":{"id":225728927,"uuid":"766691586","full_name":"penn201500/wooapi","owner":"penn201500","description":"WOO X. A privately-accessible liquidity venue for the trading of cryptocurrencies. WOO X provides clients with an easily accessible deep pool of liquidity sourced from the largest exchanges and from Kronos’ HFT proprietary trading.  This is an example to display two implement forms of WOO API.","archived":false,"fork":false,"pushed_at":"2024-03-05T07:43:10.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T13:08:17.706Z","etag":null,"topics":["api","cex","cex-api","cryptocurrencies","js","restful-api","web3","websocket","woox"],"latest_commit_sha":null,"homepage":"https://vipdocs.woo.org/?python#general-information","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/penn201500.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-03-03T23:40:14.000Z","updated_at":"2024-07-25T09:43:59.000Z","dependencies_parsed_at":"2024-03-04T00:36:01.330Z","dependency_job_id":"bcbd1daf-cc27-4300-9e2b-7a1d53a847d2","html_url":"https://github.com/penn201500/wooapi","commit_stats":null,"previous_names":["penn201500/wooapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/penn201500%2Fwooapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/penn201500%2Fwooapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/penn201500%2Fwooapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/penn201500%2Fwooapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/penn201500","download_url":"https://codeload.github.com/penn201500/wooapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245226789,"owners_count":20580753,"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":["api","cex","cex-api","cryptocurrencies","js","restful-api","web3","websocket","woox"],"created_at":"2024-12-01T15:29:44.644Z","updated_at":"2025-03-24T07:28:15.021Z","avatar_url":"https://github.com/penn201500.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WOOAPI\n\nOfficial link: https://vipdocs.woo.org/?python#general-information\n\n## To display two implement forms of WOO API\n\n## Features\n- [x] Light/Dark Theme\n- [x] Toggle-able items; sub-items can be folded or displayed\n- [x] Scrollable output text area\n- [x] RESTful API and WebSocket Interfaces displayed\n\n## Screenshots\n\nTheme Switch\n![themeSwitch](https://easyimage.netmark.top/i/2024/03/05/153438.gif)\n\nToggle-able items\n![toggleAbleItems](https://easyimage.netmark.top/i/2024/03/05/153440.gif)\n\nRESTful API Get Account Info\n![RESTful-GetAccountInfo](https://easyimage.netmark.top/i/2024/03/05/153432.gif)\n\nRESTful API Get Available Symbols\n![RESTful-GetAvailableSymbols](https://easyimage.netmark.top/i/2024/03/05/153429.gif)\n\nWebSocket PingPong Message\n![WebSocket-PingPongMessage](https://easyimage.netmark.top/i/2024/03/05/153426.gif)\n\n\n### RESTful API\n\nRead https://vipdocs.woo.org/?python#authentication\n\n\n\n**🔴Note:**\n\n```\nSome API use v1, some use v3. \n\nFor v1 API, please follow the steps to normalize request content:\n\n1. use query string as the parameters for GET methods and body parameters for POST and DELETE methods.\n2. concat query string and body parameters in an alphabetical order in query string format.\n3. concat timestamp with the above result, using | as seperator.\n\nFor v3 API using request body to pass the parameters, please concatenate the timestamp, http request method, request_path and request_body as the normalized content to sign. Besides, please use application/json as Content-Type in the headers.\n\nvar signString = timestamp + method + request_path + request_body;\n\nPut the HMAC signature in request header x-api-signature, and put timestamp in x-api-timestamp, and also api key in x-api-key.\n\n```\n\nIf you use Python, this is an example to get signature:\n\n```python\nimport datetime\nimport hmac, hashlib \nimport requests\n\nstaging_api_secret_key = 'xxxxxxxxxx'\nstaging_api_key = 'xxxxxxxxxx'\n\ndef _generate_signature(method, request_path, request_body=''):\n    key = staging_api_secret_key\n    key_bytes = bytes(key, 'utf-8')\n    timestamp = str(round(datetime.datetime.now().timestamp() * 1000))\n\n    # For a GET request, the request body will be an empty string\n    sign_data = f\"{timestamp}{method}{request_path}{request_body}\"\n    data_bytes = bytes(sign_data, 'utf-8')\n\n    signature = hmac.new(key_bytes, data_bytes, hashlib.sha256).hexdigest()\n    return timestamp, signature\n\n\ndef get_account_info():\n    # HTTP method and request path for the API call\n    http_method = \"GET\"\n    request_path = \"/v3/accountinfo\"\n    request_body = \"\"  # Empty for GET requests\n\n    # Generate timestamp and signature\n    milliseconds_since_epoch, signature = _generate_signature(http_method, request_path, request_body)\n\n    headers = {\n        'x-api-timestamp': milliseconds_since_epoch,\n        'x-api-key': staging_api_key,\n        'x-api-signature': signature,\n        'Content-Type': 'application/json',\n        'Cache-Control': 'no-cache'\n    }\n\n    response = requests.get(f'https://api.woo.org{request_path}', headers=headers)\n\n\nif __name__ == '__main__':\n    get_account_info()\n```\n\n### WebSocket\n\nRead: https://vipdocs.woo.org/?javascript#websocket-api-v2\n\nHere is an example:\n\n```javascript\nimport WebSocket from 'ws';\n\nconst API_SERVER_WSS = 'wss://wss.woo.org/ws/stream';\nconst applicationId = process.env.WOO_API_APP_ID;\nconst wssUrl = `${API_SERVER_WSS}/${applicationId}`;\nconst socket = new WebSocket(wssUrl);\n\nconsole.log('WebSocket URL:', wssUrl);\n\nsocket.onopen = function(event) {\n    console.log('WebSocket is connected.');\n\n    // The server will send a ping command to the client every 10 seconds.\n    // If the pong from client is not received within 10 seconds for 10 consecutive times,\n    // it will actively disconnect the client.\n    const pongMsg = JSON.stringify({ event: 'pong' });\n\n    // Send a pong message every 10 seconds to keep the connection alive\n    setInterval(() =\u003e {\n        socket.send(pongMsg);\n    }, 10000);\n};\n\nsocket.onmessage = function(event) {\n    console.log('Message from server:', event.data);\n    const data = JSON.parse(event.data);\n\n    // If the server requires a pong message, respond accordingly\n    if (data \u0026\u0026 data.event === 'ping') {\n        socket.send(JSON.stringify({ event: 'pong' }));\n    }\n};\n\nsocket.onerror = function(error) {\n    console.error('WebSocket Error:', error);\n};\n\nsocket.onclose = function(event) {\n    console.log('WebSocket is closed now.');\n};\n\n```\n\n## Deployment\n\n1. Go to https://x.woo.org/en/account to get an API key.\n2. Export `WOO_API_KEY`, `WOO_API_SECRET` to your .bash or .zshrc file. Source it.\n3. Running server.js on a server. Install the node modules if needed.\n4. Open script.js, change the value of localhost to the server ip where you deployed your server.js\n`const API_SERVER = 'http://localhost:63343';`\n5. Open index.html, click items to test it.\n6. websocket.js will run local and just need `WOO_API_APPLICATION_ID`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpenn201500%2Fwooapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpenn201500%2Fwooapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpenn201500%2Fwooapi/lists"}