{"id":24496848,"url":"https://github.com/10mohi6/zaif-api-python-client","last_synced_at":"2025-03-15T06:16:34.871Z","repository":{"id":50205461,"uuid":"132595364","full_name":"10mohi6/zaif-api-python-client","owner":"10mohi6","description":"zaif-client is a python client (sync/async) library for zaif api","archived":false,"fork":false,"pushed_at":"2022-12-08T04:49:54.000Z","size":11,"stargazers_count":2,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-20T09:25:19.925Z","etag":null,"topics":["api","async","client","python","wrapper","zaif"],"latest_commit_sha":null,"homepage":"","language":"Python","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/10mohi6.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-08T10:51:49.000Z","updated_at":"2019-04-23T05:16:36.000Z","dependencies_parsed_at":"2023-01-24T16:00:10.936Z","dependency_job_id":null,"html_url":"https://github.com/10mohi6/zaif-api-python-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10mohi6%2Fzaif-api-python-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10mohi6%2Fzaif-api-python-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10mohi6%2Fzaif-api-python-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10mohi6%2Fzaif-api-python-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/10mohi6","download_url":"https://codeload.github.com/10mohi6/zaif-api-python-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243690173,"owners_count":20331729,"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","async","client","python","wrapper","zaif"],"created_at":"2025-01-21T21:19:06.162Z","updated_at":"2025-03-15T06:16:34.846Z","avatar_url":"https://github.com/10mohi6.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zaif-client\n\n[![PyPI version](https://badge.fury.io/py/zaif-client.svg)](https://badge.fury.io/py/zaif-client) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nzaif-client is a python client (sync/async) library for zaif api\n\n## Installation\n\n    $ pip install zaif-client\n\n## Usage\n\n### Public\n```python\n#\n# sync\n#\nfrom zaif_client.public import Public\n\nclient = Public(public_key='your key', private_key='your secret key')\nresponse = client.ticker()\nprint(response.status_code, response.json())\n\n#\n# async\n#\nimport grequests\nfrom zaif_client.publicasync import PublicAsync\n\nclient = PublicAsync(public_key='your key', private_key='your secret key')\nreqs = [client.ticker(), client.depth(), ...]\nresponse = grequests.map(reqs)\nfor r in response:\n\tprint(r.status_code, r.json())\n\n#\n# /currencies/{currency}\n#\nclient.currencies(currency='all')\n# [{\"name\": \"btc\",\"is_token\": false},{\"name\": \"XCP\",\"is_token\": true},...]\n\n#\n# /currency_pairs/{currency_pair}\n#\nclient.currency_pairs(currency_pair='all')\n# [{\"name\": \"BTC/JPY\",\"title\": \"BTC/JPY\",\"currency_pair\": \"btc_jpy\",\"description\": \"\\u30d3\\u30c3\\u30c8\\u30b3\\u30a4\\u30f3\\u30fb\\u65e5\\u672c\\u5186\\u306e\\u53d6\\u5f15\\u3092\\u884c\\u3046\\u3053\\u3068\\u304c\\u3067\\u304d\\u307e\\u3059\",\"is_token\": false,\"event_number\": 0,\"item_unit_min\": 0.0001,\"item_unit_step\": 0.0001,\"aux_unit_min\": 5.0,\"aux_unit_step\": 5.0,\"seq\": 0,\"aux_japanese\": \"\\u65e5\\u672c\\u5186\",\"item_japanese\": \"\\u30d3\\u30c3\\u30c8\\u30b3\\u30a4\\u30f3\",\"aux_unit_point\": 0,},{\"name\": \"KINOKOUSAKA/JPY\",\"title\": \"KINOKOUSAKA/JPY \\u53d6\\u5f15\\u6240 - ZAIF Exchange\",\"currency_pair\": \"kinokousaka_jpy\",\"description\": \"KINOKOUSAKA/JPY \\u53d6\\u5f15\\u6240\\u3002KINOKOUSAKA\\u3068\\u65e5\\u672c\\u5186\\u306e\\u53d6\\u5f15\\u304c\\u884c\\u3048\\u307e\\u3059\\u3002\",\"is_token\": true,\"event_number\": 1,\"item_unit_min\": 0.01,\"item_unit_step\": 0.01,\"aux_unit_min\": 0.01,\"aux_unit_step\": 0.01,\"seq\": 134,\"aux_japanese\": \"\\u65e5\\u672c\\u5186\",\"item_japanese\": \"KINOKOUSAKA\",\"aux_unit_point\": 2,}...]\n\n#\n# /last_price/{currency_pair}\n#\nclient.last_price(currency_pair='btc_jpy')\n# {\"last_price\": 134820.0}\n\n#\n# /ticker/{currency_pair}\n#\nclient.ticker(currency_pair='btc_jpy')\n# {\"last\": 135875.0,\"high\": 136000.0,\"low\": 131570.0,\"vwap\": 133301.7489,\"volume\": 6889.215,\"bid\": 135875.0,\"ask\": 135920.0}\n\n#\n# /trades/{currency_pair}\n#\nclient.trades(currency_pair='btc_jpy')\n# [{\"date\": 1491756592,\"price\": 135340.0,\"amount\": 0.02,\"tid\": 43054307,\"currency_pair\": \"btc_jpy\",\"trade_type\": \"ask\"},{\"date\": 1491756591,\"price\": 135345.0,\"amount\": 0.01,\"tid\": 43054306,\"currency_pair\": \"btc_jpy\",\"trade_type\": \"bid\"},...]\n\n#\n# /depth/{currency_pair}\n#\nclient.depth(currency_pair='btc_jpy')\n# {\"asks\": [[134875.0,0.0063],[134885.0,0.1639],...],\"bids\": [[134870.0,0.01],[134865.0,0.3066],...]}\n```\n\n### Trade\n```python\n#\n# sync\n#\nfrom zaif_client.trade import Trade\n\nclient = Trade(public_key='your key', private_key='your secret key')\nresponse = client.get_info()\nprint(response.status_code, response.json())\n\n#\n# async\n#\nimport grequests\nfrom zaif_client.tradeasync import TradeAsync\n\nclient = TradeAsync(public_key='your key', private_key='your secret key')\nreqs = [client.get_info(), client.get_info2(), ...]\nresponse = grequests.map(reqs)\nfor r in response:\n\tprint(r.status_code, r.json())\n\n#\n# get_info\n#\nclient.get_info()\n# {\"success\":1,\"return\":{\"funds\":{\"jpy\":15320,\"btc\":1.389,\"xem\":100.2,\"mona\":2600,\"pepecash\":0.1},\"deposit\":{\"jpy\":20440,\"btc\":1.479,\"xem\":100.2,\"mona\":3200,\"pepecash\":0.1},\"rights\":{\"info\":1,\"trade\":1,\"withdraw\":0,\"personal_info\":0,\"id_info\":0,},\"trade_count\":18,\"open_orders\":3,\"server_time\":1401950833}}\n\n#\n# get_info2\n#\nclient.get_info2()\n# {\"success\": 1,\"return\": {\"funds\": {\"jpy\": 15320,\"btc\": 1.389,\"xem\": 100.2,\"mona\": 2600,\"pepecash\": 0.1},\"deposit\": {\"jpy\": 20440,\"btc\": 1.479,\"xem\": 100.2,\"mona\": 3200,\"pepecash\": 0.1},\"rights\": {\"info\": 1,\"trade\": 1,\"withdraw\": 0,\"personal_info\": 0},\"open_orders\": 3,\"server_time\": 1401950833}\n\n#\n# get_personal_info\n#\nclient.get_personal_info()\n# {\"success\": 1,\"return\": {\"ranking_nickname\": \"ニックネーム\",\"icon_path\": \"https://abs.twimg.com/sticky/default_profile_images/default_profile_0_normal.png\"}}\n\n#\n# get_id_info\n#\nclient.get_id_info()\n# {'success': 1, 'return': {'user': {'certified': True, 'kana': 'カナ', 'id': 123123, 'name': '氏名', 'email': 'メール'}}}\n\n#\n# trade_history\n#\nclient.trade_history()\n# {\"success\": 1,\"return\": {\"182\": {\"currency_pair\": \"btc_jpy\",\"action\": \"bid\",\"amount\": 0.03,\"price\": 56000,\"fee\": 0,\"your_action\": \"ask\",\"bonus\": 1.6,\"timestamp\": 1402018713,\"comment\" : \"demo\"}}}\n\n#\n# active_orders\n#\nclient.active_orders()\n# {\"success\": 1,\"return\": {\"184\": {\"currency_pair\": \"btc_jpy\",\"action\": \"ask\",\"amount\": 0.03,\"price\": 56000,\"timestamp\": 1402021125,\"comment\" : \"demo\"}}}is_token_bothがtrueの時は下記{\"success\": 1,\"return\": {\"active_orders\": {\"184\": {\"currency_pair\": \"btc_jpy\",\"action\": \"ask\",\"amount\": 0.03,\"price\": 56000,\"timestamp\": 1402021125,\"comment\" : \"demo\"},\"token_active_orders\": {\"235\": {\"currency_pair\": \"kaori_jpy\",\"action\": \"ask\",\"amount\": 0.3,\"price\": 10,\"timestamp\": 1402064525,\"comment\" : \"demo\"}}}}}\n\n#\n# trade\n#\nclient.trade(currency_pair='btc_jpy', action='bid', price=1, amount=1)\n# {\"success\": 1,\"return\": {\"received\": 0.1,\"remains\": 0,\"order_id\": 0,\"funds\": {\"jpy\": 325,\"btc\": 1.392,\"mona\": 2600}}}\n\n#\n# cancel_order\n#\nclient.cancel_order(currency_pair='btc_jpy', order_id=184)\n# {\"success\": 1,\"return\": {\"order_id\": 184,\"funds\": {\"jpy\": 15320,\"btc\": 1.392,\"mona\": 2600,\"kaori\": 0.1}}}\n\n#\n# withdraw\n#\nclient.withdraw(currency='btc', address='xxxxxxx', amount=1)\n# {\"success\": 1,\"return\": {\"id\": 23634,\"fee\": 0.001,\"txid\":,\"funds\": {\"jpy\": 15320,\"btc\": 1.392,\"xem\": 100.2,\"mona\": 2600}}\n\n#\n# deposit_history\n#\nclient.deposit_history(currency='jpy')\n# {\"success\":1,\"return\":{\"3816\":{\"timestamp\":1435745065,\"address\":\"12qwQ3sPJJAosodSUhSpMds4WfUPBeFEM2\",\"amount\":0.001,\"txid\":\"64dcf59523379ba282ae8cd61d2e9382c7849afe3a3802c0abb08a60067a159f\",},\"3814\":{\"timestamp\":1435548083,\"address\":\"12qwQ3sPJJAosodSUhSpMds4WfUPBeFEM2\",\"amount\":0.001,\"txid\":\"7d012cfff6e67a8938f93215367eef4177604459631ea62c85550980dca71819\"},}}\n\n#\n# withdraw_history\n#\nclient.withdraw_history(currency='jpy')\n# {\"success\":1,\"return\":{\"3816\":{\"timestamp\":1435745065,\"address\":\"12qwQ3sPJJAosodSUhSpMds4WfUPBeFEM2\",\"amount\":0.001,\"txid\":\"64dcf59523379ba282ae8cd61d2e9382c7849afe3a3802c0abb08a60067a159f\",},\"3814\":{\"timestamp\":1435548083,\"address\":\"12qwQ3sPJJAosodSUhSpMds4WfUPBeFEM2\",\"amount\":0.001,\"txid\":\"7d012cfff6e67a8938f93215367eef4177604459631ea62c85550980dca71819\"},}}\n```\n\n### Futures\n```python\n#\n# sync\n#\nfrom zaif_client.futures import Futures\n\nclient = Futures(public_key='your key', private_key='your secret key')\nresponse = client.ticker()\nprint(response.status_code, response.json())\n\n#\n# async\n#\nimport grequests\nfrom zaif_client.futuresasync import FuturesAsync\n\nclient = FuturesAsync(public_key='your key', private_key='your secret key')\nreqs = [client.ticker(), client.depth(), ...]\nresponse = grequests.map(reqs)\nfor r in response:\n\tprint(r.status_code, r.json())\n\n#\n# /groups/{group_id}\n#\nclient.groups(group_id='all')\n# [{\"id\": 1,\"currency_pair\": \"btc_jpy\",\"start_timestamp\": 1480518000,\"end_timestamp\": 4102412399,\"use_swap\": false},{\"id\": 2,\"currency_pair\": \"btc_jpy\",\"start_timestamp\": 1488294000,\"end_timestamp\": 1498834800,\"use_swap\": false}]\n\n#\n# /last_price/{group_id}/{currency_pair}\n#\nclient.last_price(group_id='all', currency_pair='btc_jpy')\n# [{\"last_price\": 112155.0, \"group_id\": 1},{\"last_price\": 106100.0, \"group_id\": 2},...]\n\n#\n# /ticker/{group_id}/{currency_pair}\n#\nclient.ticker(group_id=1, currency_pair='btc_jpy')\n# {\"last\": 112155.0,\"high\": 117000.0,\"low\": 112155.0,\"vwap\": 115847.1429,\"volume\": 150.0007,\"bid\": 116995.0,\"ask\": 117000.0}\n\n#\n# /trades/{group_id}/{currency_pair}\n#\nclient.trades(group_id=1, currency_pair='btc_jpy')\n# [{\"date\": 1491756592,\"price\": 135340.0,\"amount\": 0.02,\"tid\": 102659,\"currency_pair\": \"btc_jpy\",\"trade_type\": \"ask\"},{\"date\": 1491756591,\"price\": 135345.0,\"amount\": 0.01,\"tid\": 102658,\"currency_pair\": \"btc_jpy\",\"trade_type\": \"bid\"},...]\n\n#\n# /depth/{group_id}/{currency_pair}\n#\nclient.depth(group_id=1, currency_pair='btc_jpy')\n# {\"asks\": [[134875.0,0.0063],[134885.0,0.1639],...],\"bids\": [[134870.0,0.01],[134865.0,0.3066],...]}\n```\n\n### Leverage\n```python\n#\n# sync\n#\nfrom zaif_client.leverage import Leverage\n\nclient = Leverage(public_key='your key', private_key='your secret key')\nresponse = client.ticker()\nprint(response.status_code, response.json())\n\n#\n# async\n#\nimport grequests\nfrom zaif_client.leverageasync import LeverageAsync\n\nclient = LeverageAsync(public_key='your key', private_key='your secret key')\nreqs = [client.ticker(), client.depth(), ...]\nresponse = grequests.map(reqs)\nfor r in response:\n\tprint(r.status_code, r.json())\n\n#\n# get_positions\n#\nclient.get_positions(group_id=1, type='margin')\n# {\"success\": 1,\"return\": {\"182\": {\"group_id\": 1,\"currency_pair\": \"btc_jpy\",\"action\": \"bid\",\"leverage\": 2.5,\"price\": 110005,\"limit\": 130000,\"stop\": 90000,\"amount\": 0.03,\"fee_spent\": 0,\"timestamp\": 1402018713,\"term_end\": 1404610713,\"timestamp_closed\": 1402019000,\"deposit\": 35.76 ,\"deposit_jpy\": 35.76,\"refunded\": 35.76 ,\"refunded_jpy\": 35.76,\"swap\": 0,}}}\n\n#\n# position_history\n#\nclient.position_history(group_id=1, type='margin', leverage_id=1)\n# {\"success\": 1,\"return\": {\"182\": {\"group_id\": 1,\"currency_pair\": \"btc_jpy\",\"action\": \"bid\",\"amount\": 0.0001,\"price\": 499000\"timestamp\": 1504251232\"your_action\": \"bid\",\"bid_leverage_id\": 182,},\"183\": {\"group_id\": 1,\"currency_pair\": \"btc_jpy\",\"action\": \"ask\",\"amount\": 0.0001,\"price\": 450000\"timestamp\": 1504251267\"your_action\": \"ask\",\"ask_leverage_id\": 182,},}}\n\n#\n# active_positions\n#\nclient.active_positions(group_id=1, type='margin')\n# {\"success\": 1,\"return\": {\"184\": {\"group_id\": \"1\",\"currency_pair\": \"btc_jpy\",\"action\": \"ask\",\"amount\": 0.0001,\"price\": 450000,\"timestamp\": 1402021125,\"term_end\": 1404613125,\"leverage\": 1,\"fee_spent\": 0.0015,\"price_avg\": 450000,\"amount_done\": 0.0001,\"deposit_jpy\": 48.72}}}\n\n#\n# create_position\n#\nclient.create_position(group_id=1, type='margin', currency_pair='btc_jpy', action='bid', price=1, amount=1, leverage=1)\n# {\"success\": 1,\"return\": {\"leverage_id\": 22258,\"timestamp\": 1504253833,\"term_end\": 1506845833,\"price_avg\": 118000,\"amount_done\": 0.0001,\"deposit_jpy\": 11.92,\"funds\": {\"jpy\": 325,\"btc\": 1.392,\"mona\": 2600}}}\n\n#\n# change_position\n#\nclient.change_position(group_id=1, type='margin', leverage_id=1, price=1)\n# {\"success\": 1,\"return\": {\"leverage_id\": 22258,\"price_avg\": 118000,\"amount_done\": 0.0001,}}\n\n#\n# cancel_position\n#\nclient.cancel_position(group_id=1, type='margin', leverage_id=1)\n# {'success': 1,'return': {'leverage_id': 2072,'refunded_jpy': 645.96,'funds': {'btc': 0.496,'jpy': 1564.96,'xem': 0.0,'mona': 10.0},'fee_spent': 0.0,'timestamp_closed': '1508384951','swap': 0.0}}\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F10mohi6%2Fzaif-api-python-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F10mohi6%2Fzaif-api-python-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F10mohi6%2Fzaif-api-python-client/lists"}