Skip to content

Commit bbb8aa2

Browse files
committed
Added the getcoindata and getorderstatus methods
1 parent e8549fe commit bbb8aa2

File tree

1 file changed

+36
-22
lines changed

1 file changed

+36
-22
lines changed

Cryptsy.py

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def post_process(self, before):
2222
if(isinstance(after['return'][x], dict)):
2323
if('datetime' in after['return'][x] and 'timestamp' not in after['return'][x]):
2424
after['return'][x]['timestamp'] = float(createTimeStamp(after['return'][x]['datetime']))
25-
25+
2626
return after
2727

2828
def api_query(self, method, req={}):
@@ -62,7 +62,7 @@ def getOrderbookData(self, marketid=None):
6262
return self.api_query("orderdata")
6363
return self.api_query("singleorderdata", {'marketid': marketid})
6464

65-
# Outputs:
65+
# Outputs:
6666
# balances_available Array of currencies and the balances availalbe for each
6767
# balances_hold Array of currencies and the amounts currently on hold for open orders
6868
# servertimestamp Current server timestamp
@@ -73,7 +73,7 @@ def getInfo(self):
7373
return self.api_query('getinfo')
7474

7575

76-
# Outputs: Array of Active Markets
76+
# Outputs: Array of Active Markets
7777
# marketid Integer value representing a market
7878
# label Name for this market, for example: AMC/BTC
7979
# primary_currency_code Primary currency code, for example: AMC
@@ -86,7 +86,7 @@ def getInfo(self):
8686
# low_trade 24 hour lowest trade price in this market
8787
def getMarkets(self):
8888
return self.api_query('getmarkets')
89-
89+
9090
#Outputs: Array of Wallet Statuses
9191
#currencyid Integer value representing a currency
9292
#name Name for this currency, for example: Bitcoin
@@ -103,7 +103,7 @@ def getWalletStatus(self):
103103
return self.api_query('getwalletstatus')
104104

105105

106-
# Outputs: Array of Deposits and Withdrawals on your account
106+
# Outputs: Array of Deposits and Withdrawals on your account
107107
# currency Name of currency account
108108
# timestamp The timestamp the activity posted
109109
# datetime The datetime the activity posted
@@ -118,7 +118,7 @@ def myTransactions(self):
118118
# Inputs:
119119
# marketid Market ID for which you are querying
120120
##
121-
# Outputs: Array of last 1000 Trades for this Market, in Date Decending Order
121+
# Outputs: Array of last 1000 Trades for this Market, in Date Decending Order
122122
# datetime Server datetime trade occurred
123123
# tradeprice The price the trade occurred at
124124
# quantity Quantity traded
@@ -130,7 +130,7 @@ def marketTrades(self, marketid):
130130
# Inputs:
131131
# marketid Market ID for which you are querying
132132
##
133-
# Outputs: 2 Arrays. First array is sellorders listing current open sell orders ordered price ascending. Second array is buyorders listing current open buy orders ordered price descending.
133+
# Outputs: 2 Arrays. First array is sellorders listing current open sell orders ordered price ascending. Second array is buyorders listing current open buy orders ordered price descending.
134134
# sellprice If a sell order, price which order is selling at
135135
# buyprice If a buy order, price the order is buying at
136136
# quantity Quantity on order
@@ -143,7 +143,7 @@ def marketOrders(self, marketid):
143143
# marketid Market ID for which you are querying
144144
# limit (optional) Limit the number of results. Default: 200
145145
##
146-
# Outputs: Array your Trades for this Market, in Date Decending Order
146+
# Outputs: Array your Trades for this Market, in Date Decending Order
147147
# tradeid An integer identifier for this trade
148148
# tradetype Type of trade (Buy/Sell)
149149
# datetime Server datetime trade occurred
@@ -154,7 +154,7 @@ def myTrades(self, marketid, limit=200):
154154
return self.api_query('mytrades', {'marketid': marketid, 'limit': limit})
155155

156156

157-
# Outputs: Array your Trades for all Markets, in Date Decending Order
157+
# Outputs: Array your Trades for all Markets, in Date Decending Order
158158
# tradeid An integer identifier for this trade
159159
# tradetype Type of trade (Buy/Sell)
160160
# datetime Server datetime trade occurred
@@ -169,7 +169,7 @@ def allMyTrades(self):
169169
# Inputs:
170170
# marketid Market ID for which you are querying
171171
##
172-
# Outputs: Array of your orders for this market listing your current open sell and buy orders.
172+
# Outputs: Array of your orders for this market listing your current open sell and buy orders.
173173
# orderid Order ID for this order
174174
# created Datetime the order was created
175175
# ordertype Type of order (Buy/Sell)
@@ -183,16 +183,16 @@ def myOrders(self, marketid):
183183
# Inputs:
184184
# marketid Market ID for which you are querying
185185
##
186-
# Outputs: Array of buy and sell orders on the market representing market depth.
186+
# Outputs: Array of buy and sell orders on the market representing market depth.
187187
# Output Format is:
188188
# array(
189189
# 'sell'=>array(
190-
# array(price,quantity),
190+
# array(price,quantity),
191191
# array(price,quantity),
192192
# ....
193-
# ),
193+
# ),
194194
# 'buy'=>array(
195-
# array(price,quantity),
195+
# array(price,quantity),
196196
# array(price,quantity),
197197
# ....
198198
# )
@@ -201,7 +201,7 @@ def depth(self, marketid):
201201
return self.api_query('depth', {'marketid': marketid})
202202

203203

204-
# Outputs: Array of all open orders for your account.
204+
# Outputs: Array of all open orders for your account.
205205
# orderid Order ID for this order
206206
# marketid The Market ID this order was created for
207207
# created Datetime the order was created
@@ -219,30 +219,30 @@ def allMyOrders(self):
219219
# quantity Amount of units you are buying/selling in this order
220220
# price Price per unit you are buying/selling at
221221
##
222-
# Outputs:
222+
# Outputs:
223223
# orderid If successful, the Order ID for the order which was created
224224
def createOrder(self, marketid, ordertype, quantity, price):
225225
return self.api_query('createorder', {'marketid': marketid, 'ordertype': ordertype, 'quantity': quantity, 'price': price})
226-
226+
227227

228228
# Inputs:
229229
# orderid Order ID for which you would like to cancel
230230
##
231-
# Outputs: If successful, it will return a success code.
231+
# Outputs: If successful, it will return a success code.
232232
def cancelOrder(self, orderid):
233233
return self.api_query('cancelorder', {'orderid': orderid})
234234

235235

236236
# Inputs:
237237
# marketid Market ID for which you would like to cancel all open orders
238238
##
239-
# Outputs:
239+
# Outputs:
240240
# return Array for return information on each order cancelled
241241
def cancelMarketOrders(self, marketid):
242242
return self.api_query('cancelmarketorders', {'marketid': marketid})
243243

244244

245-
# Outputs:
245+
# Outputs:
246246
# return Array for return information on each order cancelled
247247
def cancelAllOrders(self):
248248
return self.api_query('cancelallorders')
@@ -252,7 +252,7 @@ def cancelAllOrders(self):
252252
# quantity Amount of units you are buying/selling
253253
# price Price per unit you are buying/selling at
254254
##
255-
# Outputs:
255+
# Outputs:
256256
# fee The that would be charged for provided inputs
257257
# net The net total with fees
258258
def calculateFees(self, ordertype, quantity, price):
@@ -263,7 +263,7 @@ def calculateFees(self, ordertype, quantity, price):
263263
# currencyid Currency ID for the coin you want to generate a new address for (ie. 3 = BitCoin)
264264
# currencycode Currency Code for the coin you want to generate a new address for (ie. BTC = BitCoin)
265265
##
266-
# Outputs:
266+
# Outputs:
267267
# address The new generated address
268268
def generateNewAddress(self, currencyid=None, currencycode=None):
269269

@@ -275,3 +275,17 @@ def generateNewAddress(self, currencyid=None, currencycode=None):
275275
return None
276276

277277
return self.api_query('generatenewaddress', req)
278+
279+
280+
# Inputs:
281+
# orderid Order ID for which you are querying
282+
##
283+
# Outputs: tradeinfo is a list of all the trades that have occured in your order. Where orderinfo shows realtime status of the order. Orderinfo contains the 'active'; a boolean object showing if the order is still open. Orderinfo also contains 'remainqty' which shows the quantity left in your order.
284+
# tradeinfo A list of all trades that have occuried in your order.
285+
# orderinfo Information regarding status of the order. Contains 'active' and 'remainqty' keys.
286+
287+
def getOrderStatus(self, orderid):
288+
return self.api_query('getorderstatus', {'orderid': orderid})
289+
290+
def getCoinData(self):
291+
return self.api_query('getcoindata')

0 commit comments

Comments
 (0)