Skip to main content
# Coincheck: Coincheck Api Library

coincheck は [coincheck](https://coincheck.com) の python 製 api ライブラリです.

```
> from coincheck import market
> m1 = market.Market()
> m1.ticker()
'{"last":30930,"bid":30810,"ask":30930,"high":31500,"low":30220,"volume":"560.51814602","timestamp":1428338044}'
```

## Documentation

Documentation for Coincheck API is available at https://coincheck.com/documents/exchange/api

### Order

注文が決済されたら、キャンセルできないので注意してください.

```
# 20000 jpy で 0.1 の bitcoin を購入する注文をする.
> from coincheck import order, market, account
> o1 = order.Order(secret_key=settings.secret_key, access_key=settings.access_key)
> print(o1.buy_btc_jpy(rate=20000, amount=0.1))
{"success":true,"id":1355414,"amount":"0.1","rate":"20000.0","order_type":"buy","pair":"btc_jpy","created_at":"2015-04-06T16:56:19.821Z"}

# 40000 jpy で 0.1 の bitcoin を売却する注文をする.
> from coincheck import order, market, account
> o1 = order.Order(secret_key=settings.secret_key, access_key=settings.access_key)
> print(o1.sell_btc_jpy(rate=40000,amount=0.1))
{"success":true,"id":1355421,"amount":"0.1","rate":"40000.0","order_type":"sell","pair":"btc_jpy","created_at":"2015-04-06T16:57:26.487Z"}

# 自分の注文の一覧を表示する.
> from coincheck import order, market, account
> o1 = order.Order(secret_key=settings.secret_key, access_key=settings.access_key)
> print(o1.list())
{"success":true,"orders":[{"id":676197,"order_type":"buy","rate":20000,"pair":"btc_jpy","pending_amount":"0.1","created_at":"2015-04-06T16:56:19.000Z"},{"id":676201,"order_type":"sell","rate":40000,"pair":"btc_jpy","pending_amount":"0.1","created_at":"2015-04-06T16:57:26.000Z"}]}

# 注文番号 676197 の注文をキャンセルする. (注文番号は coincheck.order.list() のid)
> from coincheck import order, market, account
> o1 = order.Order(secret_key=settings.secret_key, access_key=settings.access_key)
> print(o1.cancel('676197'))
{"success":true,"id":676197}

# 自分の取引履歴を表示する.
> from coincheck import order, market, account
> o1 = order.Order(secret_key=settings.secret_key, access_key=settings.access_key)
> print(o1.history())
{"success":true,"transactions":[{"id":21118,"created_at":"2015-04-06T16:39:10.000Z","funds":{"btc":"-0.02","jpy":"624.6"}}]}
```

### Market

coincheck の市場情報を取得します.

```
# coincheck の最新市場情報を取得する.
> from coincheck import order, market, account
> m1 = market.Market()
> print(m1.ticker())
{"last":30820,"bid":30810,"ask":30820,"high":31500,"low":30220,"volume":"559.78124602","timestamp":1428340013}

# coincheck の最新取引履歴を取得する.
> from coincheck import order, market, account
> m1 = market.Market()
> print(m1.trades())
[{"id":16143,"amount":"0.25","rate":30820,"order_type":"sell","created_at":"2015-04-06T17:02:04.000Z"},{"id":16142,"amount":"0.249","rate":30930,"order_type":"buy","created_
at":"2015-04-06T16:33:12.000Z"},{"id":16141,"amount":"0.4174","rate":30810,"order_type": ...

# coincheck の最新板情報を取得する.
> from coincheck import order, market, account
> m1 = market.Market()
> print(m1.orderbooks())
{"asks":[[31740,"2.25731223"],[31750,"0.35"],...],"bids":[[30810,"0.16228497"],[30700,"3.404"],...]}
```

### Account

ユーザのアカウント情報を取得します.

```
# アカウントの情報を表示します.
> from coincheck import order, market, account
> a1 = account.Account(secret_key=settings.secret_key, access_key=settings.access_key)
> print(a1.get_info())
{"success":true,"id":0000,"email":"kamonshohei@gmail.com","identity_status":"identity_verified","bitcoin_address":"..."}

# アカウントの残高を確認できます.
> from coincheck import order, market, account
> a1 = account.Account(secret_key=settings.secret_key, access_key=settings.access_key)
> print(a1.get_balance())
{"success":true,"jpy":"...","btc":"...","jpy_reserved":"...","btc_reserved":"...","jpy_lend_in_use":"...","btc_lend_in_use":"...","jpy_lent":"...","btc_lent":"...","jpy_debt":"...","btc_debt":"..."}
```


## Environment

- support Python 3.x,2.7)

## Installation


### git

```
git clone git@github.com:kmn/coincheck.git
```

### pip

```
pip install coincheck
```
## Initialization

set your api access-key and secret-key to "coincheck/settings.py"
to get your api keys , see [API key](https://coincheck.com/api_settings).

## TODO

- add test case
- add offset to market.trade()


## 0.1.11 (2018-11-2)

- Security Update related to `CVE-2018-18074`

## 0.1.10 (2016-11-11)

- Fix some bugs

## 0.1.9 (2016-11-11)

- Change domain (from coincheck.jp to coincheck.com).

## 0.1.8 (2015-12-18)

- Add test code for order
- Change return type of order instance.

## 0.1.7 (2015-12-03)

- Add test codes
- Modify Nounce value from UNIX time (sec) to UNIX time (micro sec) * 1000000000
- Fix some bugs

## 0.0.1 (2015-04-06)

- Birth!

Metadata

Release files for coincheck 0.1.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coincheck 0.1.11
File Size Uploaded Provenance Actions
coincheck-0.1.11.tar.gz 6.3 kB Without provenance Details for coincheck-0.1.11.tar.gz

Release files / coincheck-0.1.11.tar.gz

Download URL coincheck-0.1.11.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
eb5068f4a9a68ab0cf04d8542b1857bcc8f8a63a512b8ef00a0526d84724a5ad
BLAKE2b-256 checksum
How to use checksums
760f151322a12e67a844e83ca65217febe67405372fd2970e3dd10ac500893a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4

Security for coincheck 0.1.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page