Skip to content
This repository was archived by the owner on Aug 20, 2025. It is now read-only.

Commit 4f497e9

Browse files
committed
finalize api methods
1 parent ed49652 commit 4f497e9

3 files changed

Lines changed: 63 additions & 25 deletions

File tree

README.md

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,28 @@ Python Interface for [CoinTracking.info API](https://cointracking.info/api/api.p
99

1010
# Install
1111
```
12-
12+
python setup.py install
1313
```
1414

1515
# How to Use
1616

17-
This is an example how you can use the library in a python script
17+
This is an example how you can use the library:
1818
```
19-
#! /usr/bin/env python
19+
#!/usr/bin/env python2
2020
21-
from ctapi import CTAPI
21+
from ctapi.ctapi import CTAPI
2222
2323
api_key = <YourAPIKey>
2424
api_secret = <YourAPISecret>
2525
26+
# api = CTAPI(api_key, api_secret, debug=True)
2627
api = CTAPI(api_key, api_secret)
2728
trades = api.getTrades()
2829
2930
if trades['success']:
30-
print 'credits left: {0}'.format(trades['result']['credits'])
31+
for t in trades['result']:
32+
print trades['result'][t]
3133
32-
for order in trades['result']['orders']:
33-
print 'Order ID: {0} >>> Price: {1} EUR'.format(order['order_id'], order['price'])
3434
else:
3535
print "got no orders"
3636
```
37-
38-
39-
POST /api/v1/getTrades HTTP/1.1
40-
Host: cointracking.info
41-
Connection: keep-alive
42-
Accept-Encoding: gzip, deflate
43-
Accept: */*
44-
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
45-
Key: 5f3ab6b651b5ae77ca85ea20baa955fc
46-
Sign: 33b3c257ab3dab73e593bf9ba90ee722bf257632dcdcdb26aae6ca1c0fa21c983568da463d06030581b0de596541c344c8ec337370d3eec2889657e9a03af381
47-
Content-Length: 34
48-
49-
method=getTrades&nonce=15153302975

ctapi/ctapi.py

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,64 @@ def _api_query(self, method, params={}):
123123
###########################################################################
124124

125125
#
126-
# get all Trades
126+
# getTrades
127127
#
128128
def getTrades(self, **args):
129-
""" TODO """
129+
""" TODO: desc """
130130
params = {
131-
'limit': 10,
131+
'limit': 5,
132132
'order': 'DESC',
133133
}
134134
params.update(args)
135135
return self._api_query('getTrades', params)
136+
137+
#
138+
# getBalance
139+
#
140+
def getBalance(self):
141+
""" TODO: desc """
142+
return self._api_query('getBalance')
143+
144+
#
145+
# getHistoricalSummary
146+
#
147+
def getHistoricalSummary(self, **args):
148+
""" TODO: desc """
149+
params = {
150+
'btc': 0,
151+
}
152+
params.update(args)
153+
return self._api_query('getHistoricalSummary', params)
154+
155+
#
156+
# getHistoricalCurrency
157+
#
158+
def getHistoricalCurrency(self, **args):
159+
""" TODO: desc """
160+
params = {
161+
'currency': 'ETH',
162+
}
163+
params.update(args)
164+
return self._api_query('getHistoricalCurrency', params)
165+
166+
#
167+
# getGroupedBalance
168+
#
169+
def getGroupedBalance(self, **args):
170+
""" TODO: desc """
171+
params = {
172+
'group': 'exchange',
173+
}
174+
params.update(args)
175+
return self._api_query('getGroupedBalance', params)
176+
177+
#
178+
# getGains
179+
#
180+
def getGains(self, **args):
181+
""" TODO: desc """
182+
params = {
183+
'method': 'FIFO',
184+
}
185+
params.update(args)
186+
return self._api_query('getGains', params)

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from setuptools import setup, find_packages
44

55
setup(
6-
name='python-cointracking-api',
6+
name='python-ctapi',
77
version='0.1.0-dev',
88
packages=find_packages('ctapi'),
99
install_requires=[
@@ -14,7 +14,7 @@
1414

1515
author='tbl42',
1616
author_email='[email protected]',
17-
url='https://github.com/tbl42/python-cointracking-api',
17+
url='https://github.com/tbl42/python-ctapi',
1818
description='Python Interface for CoinTracking.info API',
1919
long_description=open('README.md').read(),
2020
keywords = 'cointracking info btc api',

0 commit comments

Comments
 (0)