Skip to content

Instantly share code, notes, and snippets.

@radpath
Created October 28, 2020 03:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radpath/2bd8e5a22a92eb367b4a792dc3493563 to your computer and use it in GitHub Desktop.
Save radpath/2bd8e5a22a92eb367b4a792dc3493563 to your computer and use it in GitHub Desktop.
Error trying to place limit order on the Nash DEX
import {
Client,
EnvironmentConfiguration,
CryptoCurrency,
createCurrencyAmount,
createCurrencyPrice,
OrderBuyOrSell,
OrderCancellationPolicy
} from '@neon-exchange/api-client-typescript'
const nashClient = new Client(EnvironmentConfiguration.production)
nashClient.login(require('./1234.json'))
const run = async () => {
try {
let balance = await nashClient.getAccountBalance(CryptoCurrency.BTC)
console.log(balance)
console.log('trying to place limit order')
// The next line of code yields the following error:
// Could not get nonce set: TypeError: Cannot read property 'eth' of undefined
// 2020-10-28T02:59:13.026Z
// Caught error
// TypeError: Cannot read property 'btc' of undefined
// at Client.prefillRPoolIfNeededForAssets (C:\Users\ectsa\node_modules\@neon-exchange\api-client-typescript\build\main\client\client.js:302:43)
// at Client.placeLimitOrder (C:\Users\ectsa\node_modules\@neon-exchange\api-client-typescript\build\main\client\client.js:1542:20)
// at C:\Users\ectsa\trade.js:53:49
// at step (C:\Users\ectsa\trade.js:33:23)
// at Object.next (C:\Users\ectsa\trade.js:14:53)
// at fulfilled (C:\Users\ectsa\trade.js:5:58)
// at process._tickCallback (internal/process/next_tick.js:68:7)
let order = await nashClient.placeLimitOrder(
false,
createCurrencyAmount('0.020001', CryptoCurrency.ETH),
OrderBuyOrSell.SELL,
OrderCancellationPolicy.GOOD_TIL_CANCELLED,
createCurrencyPrice('0.05', CryptoCurrency.BTC, CryptoCurrency.ETH),
'eth_btc'
)
console.log(order.status)
} catch (e) {
let dateTime = new Date()
console.log(dateTime)
console.log('Caught error')
console.error(e)
}
}
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment