33A simple wrapper for the Luno API. The module supports promise and callbacks.
44
55> This module is forked from https://github.com/bausmeier/node-bitx .
6- > Since the original repository seems not to be maintained anymore, starting with version v2.0.0 this fork has been detached from original repository. It is now stand alone. Contributions are not pull-requested to original repository.
6+ > Since the original repository is not maintained anymore, starting with version v2.0.0 this fork has been detached from original repository. It is now stand alone. Contributions are not pull-requested to original repository.
77
88## Usage
99Add luno as a dependency:
@@ -13,7 +13,7 @@ $ npm install --save luno-api-node
1313```
1414
1515
16- ### Luno([ keyId, keySecret] [ options ] )
16+ ### Luno([ keyId, keySecret] [ , options] )
1717To access the private Luno API methods you must supply your key id and key secret as the first two arguments. If you are only accessing the public API endpoints you can leave these two arguments out.
1818
1919The optional ` options ` argument can be used to override the default options. The default options are equivalent to:
@@ -51,10 +51,87 @@ For details about the API endpoints see https://www.luno.com/en/developers/api.
5151The arguments passed to the callback function for each method are:
5252
53531 . An error or ` null ` if no error occurred.
54- 1 . An object containing the data returned by the Luno API.
54+ 2 . An object containing the data returned by the Luno API.
5555
5656The ` callback ` function is optional. If the ` callback ` is not provided, the methods return a promise.
5757
58+ ### createAccount(currency, name[ , callback] )
59+ POST https://api.luno.com/api/1/accounts
60+
61+ Example:
62+
63+ ``` javascript
64+ luno .createAccount (' XBT' , ' Trading ACC' , function (err , response ) {})
65+ ```
66+
67+
68+ ### updateAccountName(currency, name[ , callback] )
69+ PUT https://api.luno.com/api/1/accounts/{id}/name
70+
71+ Example:
72+
73+ ``` javascript
74+ luno .updateAccountName (12345 , ' Trading ACC' , function (err , response ) {})
75+ ```
76+
77+
78+ ### listAccountPendingTransactions(id[ , callback] )
79+ GET https://api.luno.com/api/1/accounts/{id}/pending
80+
81+ Example:
82+
83+ ``` javascript
84+ luno .listAccountPendingTransactions (12345 , function (err , response ) {})
85+ ```
86+
87+
88+ ### listAccountTransactions(id, min_row, max_row[ , callback] )
89+ GET https://api.luno.com/api/1/accounts/{id}/transactions
90+
91+ Example:
92+
93+ ``` javascript
94+ luno .listAccountTransactions (12345 , 1 , 1000 , function (err , response ) {})
95+ ```
96+
97+
98+ ### listAccountBalances([ assets] [ , callback ] )
99+ GET https://api.luno.com/api/1/balance
100+
101+ Example:
102+
103+ ``` javascript
104+ luno .listAccountBalances ([' XBT' , ' ETH' ], function (err , response ) {})
105+ ```
106+
107+ ### getMove([ options] [ , callback ] )
108+ GET https://api.luno.com/api/exchange/1/move
109+
110+ Example:
111+
112+ ``` javascript
113+ luno .getMove ({ id: 18563829047 }, function (err , response ) {})
114+ ```
115+
116+ ### move(amount, debit_account_id, credit_account_id [ ,options] [ , callback] )
117+ POST https://api.luno.com/api/exchange/1/move
118+
119+ Example:
120+
121+ ``` javascript
122+ luno .move (' 10000' , 12345 , 12346 , { client_move_id: ' mv-53960812' }, function (err , response ) {})
123+ ```
124+
125+ ### listMoves([ options] [ , callback ] )
126+ GET https://api.luno.com/api/exchange/1/move/list_moves
127+
128+ Example:
129+
130+ ``` javascript
131+ luno .listMoves ({ before: 1530865703508 , limit: 986 }, function (err , response ) {})
132+ ```
133+
134+
58135### getTicker([ options] [ , callback ] )
59136GET https://api.luno.com/api/1/ticker/XBTZAR
60137
@@ -69,7 +146,7 @@ Default options:
69146Example:
70147
71148``` javascript
72- luno .getTicker (function (err , ticker ) {});
149+ luno .getTicker (function (err , ticker ) {})
73150```
74151
75152### getAllTickers([ callback] )
@@ -78,7 +155,7 @@ GET https://api.luno.com/api/1/tickers
78155Example:
79156
80157``` javascript
81- luno .getAllTickers (function (err , tickers ) {});
158+ luno .getAllTickers (function (err , tickers ) {})
82159```
83160
84161### getOrderBook([ options] [ , callback ] )
@@ -95,7 +172,7 @@ Default options:
95172Example:
96173
97174``` javascript
98- luno .getOrderBook (function (err , orderBook ) {});
175+ luno .getOrderBook (function (err , orderBook ) {})
99176```
100177
101178### getTrades([ options] [ , callback ] )
@@ -112,7 +189,7 @@ Default options:
112189Example:
113190
114191``` javascript
115- luno .getTrades (function (err , trades ) {});
192+ luno .getTrades (function (err , trades ) {})
116193```
117194
118195### getTradeList([ options] [ , callback ] )
@@ -129,7 +206,7 @@ Default options:
129206Example:
130207
131208``` javascript
132- luno .getTradeList ({sort_desc: true , limit: 10 }, function (err , tradeList ) {});
209+ luno .getTradeList ({ sort_desc: true , limit: 10 }, function (err , tradeList ) {})
133210```
134211
135212### getOrderList([ options] [ , callback ] )
@@ -147,7 +224,7 @@ Default options:
147224Example:
148225
149226``` javascript
150- luno .getOrderList ({state: ' PENDING' }, function (err , orderList ) {});
227+ luno .getOrderList ({ state: ' PENDING' }, function (err , orderList ) {})
151228```
152229
153230### getOrderListV2([ options] [ , callback ] )
@@ -165,7 +242,7 @@ Default options:
165242Example:
166243
167244``` javascript
168- luno .getOrderListV2 ({ closed: true }, function (err , orderList ) {});
245+ luno .getOrderListV2 ({ closed: true }, function (err , orderList ) {})
169246```
170247
171248### getOrderListV3(options[ , callback] )
@@ -174,7 +251,7 @@ GET https://api.luno.com/api/exchange/3/order
174251Example:
175252
176253``` javascript
177- luno .getOrderListV3 ({id: ' BXMC2CJ7HNB88U4' }, function (err , orderList ) {});
254+ luno .getOrderListV3 ({ id: ' BXMC2CJ7HNB88U4' }, function (err , orderList ) {})
178255```
179256
180257### getBalance([ asset] [ , callback ] )
@@ -183,7 +260,7 @@ GET https://api.luno.com/api/1/balance
183260Example:
184261
185262``` javascript
186- luno .getBalance (' ZAR' , function (err , balance ) {});
263+ luno .getBalance (' ZAR' , function (err , balance ) {})
187264```
188265
189266### getFundingAddress(asset[ , options] [ , callback ] )
@@ -200,7 +277,7 @@ Default options:
200277Example:
201278
202279``` javascript
203- luno .getFundingAddress (' XBT' , {address: ' B1tC0InExAMPL3fundIN6AdDreS5t0Use' }, function (err , fundingAddress ) {});
280+ luno .getFundingAddress (' XBT' , { address: ' B1tC0InExAMPL3fundIN6AdDreS5t0Use' }, function (err , fundingAddress ) {})
204281```
205282
206283### createFundingAddress(asset[ , callback] )
@@ -209,7 +286,7 @@ POST https://api.luno.com/api/1/funding_address
209286Example:
210287
211288``` javascript
212- luno .createFundingAddress (' XBT' , function (err , fundingAddress ) {});
289+ luno .createFundingAddress (' XBT' , function (err , fundingAddress ) {})
213290```
214291
215292### getFeeInfo([ options] [ , callback ] )
@@ -226,7 +303,7 @@ Default options:
226303Example:
227304
228305``` javascript
229- luno .getFeeInfo ({pair: ' XBTZAR' }, function (err , feeInfo ) {});
306+ luno .getFeeInfo ({ pair: ' XBTZAR' }, function (err , feeInfo ) {})
230307```
231308
232309### postBuyOrder(volume, price[ , options] [ , callback ] )
@@ -235,7 +312,7 @@ POST https://api.luno.com/api/1/postorder
235312Example:
236313
237314``` javascript
238- luno .postBuyOrder (9999.99 , 0.01 , function (err , order ) {});
315+ luno .postBuyOrder (9999.99 , 0.01 , function (err , order ) {})
239316```
240317
241318### postSellOrder(volume, price[ , options] [ , callback ] )
@@ -244,7 +321,7 @@ POST https://api.luno.com/api/1/postorder
244321Example:
245322
246323``` javascript
247- luno .postSellOrder (0.01 , 9999.99 , function (err , order ) {});
324+ luno .postSellOrder (0.01 , 9999.99 , function (err , order ) {})
248325```
249326
250327### postMarketBuyOrder(volume[ , options] [ , callback ] )
@@ -253,7 +330,7 @@ POST https://api.luno.com/api/1/marketorder
253330Example:
254331
255332``` javascript
256- luno .postMarketBuyOrder (0.01 , function (err , order ) {});
333+ luno .postMarketBuyOrder (0.01 , function (err , order ) {})
257334```
258335
259336### postMarketSellOrder(volume[ , options] [ , callback ] )
@@ -262,7 +339,7 @@ POST https://api.luno.com/api/1/marketorder
262339Example:
263340
264341``` javascript
265- luno .postMarketSellOrder (0.01 , function (err , order ) {});
342+ luno .postMarketSellOrder (0.01 , function (err , order ) {})
266343```
267344
268345### stopOrder(orderId[ , callback] )
@@ -271,7 +348,7 @@ POST https://api.luno.com/api/1/stoporder
271348Example:
272349
273350``` javascript
274- luno .stopOrder (' BXMC2CJ7HNB88U4' , function (err , result ) {});
351+ luno .stopOrder (' BXMC2CJ7HNB88U4' , function (err , result ) {})
275352```
276353
277354### getOrder(orderId[ , callback] )
@@ -280,7 +357,7 @@ GET https://api.luno.com/api/1/orders/{orderId}
280357Example:
281358
282359``` javascript
283- luno .getOrder (' BXHW6PFRRXKFSB4' , function (err , result ) {});
360+ luno .getOrder (' BXHW6PFRRXKFSB4' , function (err , result ) {})
284361```
285362
286363### getOrderV2(orderId[ , callback] )
@@ -289,7 +366,7 @@ GET https://api.luno.com/api/exchange/2/orders/{orderId}
289366Example:
290367
291368``` javascript
292- luno .getOrder (' BXHW6PFRRXKFSB4' , function (err , result ) {});
369+ luno .getOrder (' BXHW6PFRRXKFSB4' , function (err , result ) {})
293370```
294371
295372### getTransactions(asset[ , options] [ , callback ] )
@@ -306,7 +383,7 @@ Default options:
306383Example:
307384
308385``` javascript
309- luno .getTransactions (' XBT' , {offset: 5 , limit: 20 }, function (err , transactions ) {});
386+ luno .getTransactions (' XBT' , { offset: 5 , limit: 20 }, function (err , transactions ) {})
310387```
311388
312389### getWithdrawals([ callback] )
@@ -315,7 +392,7 @@ GET https://api.luno.com/api/1/withdrawals
315392Example:
316393
317394``` javascript
318- luno .getWithdrawals (function (err , withdrawals ) {});
395+ luno .getWithdrawals (function (err , withdrawals ) {})
319396```
320397
321398### getWithdrawal(withdrawalId[ , callback] )
@@ -324,7 +401,7 @@ GET https://api.luno.com/api/1/withdrawals/{withdrawalId}
324401Example:
325402
326403``` javascript
327- luno .getWithdrawal (' 1212' , function (err , withdrawal ) {});
404+ luno .getWithdrawal (' 1212' , function (err , withdrawal ) {})
328405```
329406
330407### requestWithdrawal(type, amount[ , callback] )
@@ -333,7 +410,7 @@ POST https://api.luno.com/api/1/withdrawals
333410Example:
334411
335412``` javascript
336- luno .requestWithdrawal (' ZAR_EFT' , 1000 , function (err , withdrawal ) {});
413+ luno .requestWithdrawal (' ZAR_EFT' , 1000 , function (err , withdrawal ) {})
337414```
338415
339416### cancelWithdrawal(withdrawalId[ , callback] )
@@ -342,7 +419,7 @@ DELETE https://api.luno.com/api/1/withdrawals/{withdrawalId}
342419Example:
343420
344421``` javascript
345- luno .cancelWithdrawal (' 1212' , function (err , withdrawal ) {});
422+ luno .cancelWithdrawal (' 1212' , function (err , withdrawal ) {})
346423```
347424
348425## Contributing
0 commit comments