@narative/oanda-v20
Advanced tools
Comparing version
@@ -151,10 +151,10 @@ declare module '@narative/oanda-v20/account' { | ||
AccountChanges: typeof AccountChanges | ||
list(responseHandler: any): void | ||
get(accountID: any, responseHandler: any): void | ||
summary(accountID: any, responseHandler: any): void | ||
instruments(accountID: any, queryParams: any, responseHandler: any): void | ||
configure(accountID: any, bodyParams: any, responseHandler: any): void | ||
changes(accountID: any, queryParams: any, responseHandler: any): void | ||
list(responseHandler: any): ClientRequest | ||
get(accountID: any, responseHandler: any): ClientRequest | ||
summary(accountID: any, responseHandler: any): ClientRequest | ||
instruments(accountID: any, queryParams: any, responseHandler: any): ClientRequest | ||
configure(accountID: any, bodyParams: any, responseHandler: any): ClientRequest | ||
changes(accountID: any, queryParams: any, responseHandler: any): ClientRequest | ||
} | ||
export {} | ||
} |
@@ -1429,3 +1429,7 @@ /* jshint esversion: 6 */ | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -1497,3 +1501,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -1572,3 +1580,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -1653,3 +1665,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -1740,3 +1756,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -1859,3 +1879,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -1862,0 +1886,0 @@ { |
@@ -25,3 +25,3 @@ declare module '@narative/oanda-v20/context' { | ||
setToken(token: any): void | ||
request(method: any, path: any, body: any, streamChunkHandler: any, responseHandler: any): void | ||
request(method: any, path: any, body: any, streamChunkHandler: any, responseHandler: any): ClientRequest | ||
} | ||
@@ -28,0 +28,0 @@ export class Response { |
@@ -149,2 +149,3 @@ /* jshint esversion: 6 */ | ||
responseHandler( | ||
null, | ||
new Response( | ||
@@ -164,2 +165,9 @@ method, | ||
req.on('error', (err) => { | ||
if (responseHandler) { | ||
responseHandler(err, null) | ||
req.abort() | ||
} | ||
}) | ||
if (postData.length > 0) | ||
@@ -166,0 +174,0 @@ { |
@@ -62,7 +62,7 @@ declare module '@narative/oanda-v20/instrument' { | ||
PositionBookBucket: typeof PositionBookBucket | ||
candles(instrument: any, queryParams: any, responseHandler: any): void | ||
price(instrument: any, queryParams: any, responseHandler: any): void | ||
prices(instrument: any, queryParams: any, responseHandler: any): void | ||
orderBook(instrument: any, queryParams: any, responseHandler: any): void | ||
positionBook(instrument: any, queryParams: any, responseHandler: any): void | ||
candles(instrument: any, queryParams: any, responseHandler: any): ClientRequest | ||
price(instrument: any, queryParams: any, responseHandler: any): ClientRequest | ||
prices(instrument: any, queryParams: any, responseHandler: any): ClientRequest | ||
orderBook(instrument: any, queryParams: any, responseHandler: any): ClientRequest | ||
positionBook(instrument: any, queryParams: any, responseHandler: any): ClientRequest | ||
} | ||
@@ -69,0 +69,0 @@ export {} |
@@ -470,3 +470,7 @@ /* jshint esversion: 6 */ | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -558,3 +562,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -641,3 +649,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -721,3 +733,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -801,3 +817,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -804,0 +824,0 @@ { |
@@ -415,8 +415,8 @@ declare module '@narative/oanda-v20/order' { | ||
GuaranteedStopLossOrderEntryData: typeof GuaranteedStopLossOrderEntryData | ||
create(accountID: any, bodyParams: any, responseHandler: any): void | ||
list(accountID: any, queryParams: any, responseHandler: any): void | ||
listPending(accountID: any, responseHandler: any): void | ||
get(accountID: any, orderSpecifier: any, responseHandler: any): void | ||
replace(accountID: any, orderSpecifier: any, bodyParams: any, responseHandler: any): void | ||
cancel(accountID: any, orderSpecifier: any, responseHandler: any): void | ||
create(accountID: any, bodyParams: any, responseHandler: any): ClientRequest | ||
list(accountID: any, queryParams: any, responseHandler: any): ClientRequest | ||
listPending(accountID: any, responseHandler: any): ClientRequest | ||
get(accountID: any, orderSpecifier: any, responseHandler: any): ClientRequest | ||
replace(accountID: any, orderSpecifier: any, bodyParams: any, responseHandler: any): ClientRequest | ||
cancel(accountID: any, orderSpecifier: any, responseHandler: any): ClientRequest | ||
setClientExtensions( | ||
@@ -427,16 +427,16 @@ accountID: any, | ||
responseHandler: any, | ||
): void | ||
market(accountID: any, orderSpec: any, responseCallback: any): void | ||
limit(accountID: any, orderSpec: any, responseCallback: any): void | ||
limitReplace(accountID: any, orderID: any, orderSpec: any, responseCallback: any): void | ||
stop(accountID: any, orderSpec: any, responseCallback: any): void | ||
stopReplace(accountID: any, orderID: any, orderSpec: any, responseCallback: any): void | ||
marketIfTouched(accountID: any, orderSpec: any, responseCallback: any): void | ||
marketIfTouchedReplace(accountID: any, orderID: any, orderSpec: any, responseCallback: any): void | ||
takeProfit(accountID: any, orderSpec: any, responseCallback: any): void | ||
takeProfitReplace(accountID: any, orderID: any, orderSpec: any, responseCallback: any): void | ||
stopLoss(accountID: any, orderSpec: any, responseCallback: any): void | ||
stopLossReplace(accountID: any, orderID: any, orderSpec: any, responseCallback: any): void | ||
trailingStopLoss(accountID: any, orderSpec: any, responseCallback: any): void | ||
trailingStopLossReplace(accountID: any, orderID: any, orderSpec: any, responseCallback: any): void | ||
): ClientRequest | ||
market(accountID: any, orderSpec: any, responseCallback: any): ClientRequest | ||
limit(accountID: any, orderSpec: any, responseCallback: any): ClientRequest | ||
limitReplace(accountID: any, orderID: any, orderSpec: any, responseCallback: any): ClientRequest | ||
stop(accountID: any, orderSpec: any, responseCallback: any): ClientRequest | ||
stopReplace(accountID: any, orderID: any, orderSpec: any, responseCallback: any): ClientRequest | ||
marketIfTouched(accountID: any, orderSpec: any, responseCallback: any): ClientRequest | ||
marketIfTouchedReplace(accountID: any, orderID: any, orderSpec: any, responseCallback: any): ClientRequest | ||
takeProfit(accountID: any, orderSpec: any, responseCallback: any): ClientRequest | ||
takeProfitReplace(accountID: any, orderID: any, orderSpec: any, responseCallback: any): ClientRequest | ||
stopLoss(accountID: any, orderSpec: any, responseCallback: any): ClientRequest | ||
stopLossReplace(accountID: any, orderID: any, orderSpec: any, responseCallback: any): ClientRequest | ||
trailingStopLoss(accountID: any, orderSpec: any, responseCallback: any): ClientRequest | ||
trailingStopLossReplace(accountID: any, orderID: any, orderSpec: any, responseCallback: any): ClientRequest | ||
} | ||
@@ -443,0 +443,0 @@ export {} |
{ | ||
"name": "@narative/oanda-v20", | ||
"description": "OANDA v20 bindings for Javascript", | ||
"version": "3.0.29", | ||
"version": "3.0.30", | ||
"author": "OANDA Corporation", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/narative/v20-javascript", |
@@ -44,8 +44,8 @@ declare module '@narative/oanda-v20/position' { | ||
CalculatedPositionState: typeof CalculatedPositionState | ||
list(accountID: any, responseHandler: any): void | ||
listOpen(accountID: any, responseHandler: any): void | ||
get(accountID: any, instrument: any, responseHandler: any): void | ||
close(accountID: any, instrument: any, bodyParams: any, responseHandler: any): void | ||
list(accountID: any, responseHandler: any): ClientRequest | ||
listOpen(accountID: any, responseHandler: any): ClientRequest | ||
get(accountID: any, instrument: any, responseHandler: any): ClientRequest | ||
close(accountID: any, instrument: any, bodyParams: any, responseHandler: any): ClientRequest | ||
} | ||
export {} | ||
} |
@@ -347,3 +347,7 @@ /* jshint esversion: 6 */ | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -422,3 +426,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -499,3 +507,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -598,3 +610,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -601,0 +617,0 @@ { |
@@ -47,8 +47,8 @@ declare module '@narative/oanda-v20/pricing' { | ||
basePrices(queryParams: any, responseHandler: any): void | ||
getPriceRange(instrument: any, queryParams: any, responseHandler: any): void | ||
get(accountID: any, queryParams: any, responseHandler: any): void | ||
stream(accountID: any, queryParams: any, streamChunkHandler: any, responseHandler: any): void | ||
candles(accountID: any, instrument: any, queryParams: any, responseHandler: any): void | ||
getPriceRange(instrument: any, queryParams: any, responseHandler: any): ClientRequest | ||
get(accountID: any, queryParams: any, responseHandler: any): ClientRequest | ||
stream(accountID: any, queryParams: any, streamChunkHandler: any, responseHandler: any): ClientRequest | ||
candles(accountID: any, instrument: any, queryParams: any, responseHandler: any): ClientRequest | ||
} | ||
export {} | ||
} |
@@ -334,3 +334,7 @@ /* jshint esversion: 6 */ | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -417,3 +421,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -506,3 +514,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -602,3 +614,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -733,3 +749,8 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -736,0 +757,0 @@ { |
@@ -1,20 +0,16 @@ | ||
The OANDA v20 REST API provides programmatic access to OANDA's next generation | ||
v20 trading engine. | ||
# OANDA v20 (Narative fork) | ||
## Why | ||
- Typescript friendly (WIP) | ||
- Bug fixing | ||
## Installation | ||
If you have the node package manager, npm, installed: | ||
```shell | ||
npm install @narative/oanda-v20 | ||
yarn add @narative/oanda-v20 | ||
``` | ||
Leave off the `-g` if you don't wish to install globally. If you don't wish to use npm: | ||
``` | ||
git clone https://github.com/narative/oanda-v20.git | ||
``` | ||
## Documentation | ||
For documentation, usage and examples, see: http://developer.oanda.com/rest-live-v20/introduction |
@@ -62,6 +62,6 @@ declare module '@narative/oanda-v20/trade' { | ||
CalculatedTradeState: typeof CalculatedTradeState | ||
list(accountID: any, queryParams: any, responseHandler: any): void | ||
listOpen(accountID: any, responseHandler: any): void | ||
get(accountID: any, tradeSpecifier: any, responseHandler: any): void | ||
close(accountID: any, tradeSpecifier: any, bodyParams: any, responseHandler: any): void | ||
list(accountID: any, queryParams: any, responseHandler: any): ClientRequest | ||
listOpen(accountID: any, responseHandler: any): ClientRequest | ||
get(accountID: any, tradeSpecifier: any, responseHandler: any): ClientRequest | ||
close(accountID: any, tradeSpecifier: any, bodyParams: any, responseHandler: any): ClientRequest | ||
setClientExtensions( | ||
@@ -72,3 +72,3 @@ accountID: any, | ||
responseHandler: any, | ||
): void | ||
): ClientRequest | ||
setDependentOrders( | ||
@@ -79,5 +79,5 @@ accountID: any, | ||
responseHandler: any, | ||
): void | ||
): ClientRequest | ||
} | ||
export {} | ||
} |
36
trade.js
@@ -564,3 +564,7 @@ /* jshint esversion: 6 */ | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -639,3 +643,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -716,3 +724,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -800,3 +812,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -931,3 +947,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -1072,3 +1092,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -1075,0 +1099,0 @@ { |
@@ -878,9 +878,9 @@ declare module '@narative/oanda-v20/transaction' { | ||
TransactionHeartbeat: typeof TransactionHeartbeat | ||
list(accountID: any, queryParams: any, responseHandler: any): void | ||
get(accountID: any, transactionID: any, responseHandler: any): void | ||
range(accountID: any, queryParams: any, responseHandler: any): void | ||
since(accountID: any, queryParams: any, responseHandler: any): void | ||
stream(accountID: any, streamChunkHandler: any, responseHandler: any): void | ||
list(accountID: any, queryParams: any, responseHandler: any): ClientRequest | ||
get(accountID: any, transactionID: any, responseHandler: any): ClientRequest | ||
range(accountID: any, queryParams: any, responseHandler: any): ClientRequest | ||
since(accountID: any, queryParams: any, responseHandler: any): ClientRequest | ||
stream(accountID: any, streamChunkHandler: any, responseHandler: any): ClientRequest | ||
} | ||
export {} | ||
} |
@@ -22,6 +22,6 @@ declare module '@narative/oanda-v20/user' { | ||
UserInfoExternal: typeof UserInfoExternal | ||
getInfo(userSpecifier: any, responseHandler: any): void | ||
getExternalInfo(userSpecifier: any, responseHandler: any): void | ||
getInfo(userSpecifier: any, responseHandler: any): ClientRequest | ||
getExternalInfo(userSpecifier: any, responseHandler: any): ClientRequest | ||
} | ||
export {} | ||
} |
12
user.js
@@ -151,3 +151,7 @@ /* jshint esversion: 6 */ | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -222,3 +226,7 @@ { | ||
let handleResponse = (response) => { | ||
let handleResponse = (err, response) => { | ||
if (err) { | ||
responseHandler(err, null) | ||
return | ||
} | ||
if (response.contentType.startsWith("application/json")) | ||
@@ -225,0 +233,0 @@ { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
685879
0.7%18954
0.89%17
-19.05%