-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from sujansaundara/feat/expiry_time
Add getExpiry_Time Feature
- Loading branch information
Showing
4 changed files
with
94 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,5 @@ coinut.getPositions() | |
console.log('Positions:', positions); | ||
}) | ||
.catch(errorHandler); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const assert = require('assert'); | ||
const Coinut = require('../dist'); | ||
|
||
// import environment variables | ||
const username = process.env.COINUT_USERNAME || ''; | ||
const apiKey = process.env.COINUT_API_KEY || ''; | ||
|
||
// ensure environment variables are defined | ||
assert(username, 'Missing environment variable COINUT_USERNAME. Type ' + | ||
'`export COINUT_USERNAME=<your username>` in the terminal and try again.'); | ||
|
||
assert(apiKey, 'Missing environment variable COINUT_API_KEY. Type ' + | ||
'`export COINUT_API_KEY=<your api key>` in the terminal and try again.'); | ||
|
||
const coinut = new Coinut(username, apiKey); | ||
|
||
const errorHandler = (error) => { | ||
console.error('Error connecting to Coinut:', error.message); | ||
}; | ||
|
||
coinut.getExpiry_Time('VANILLA_OPTION', 'BTCUSD', 'CALL' ) | ||
.then(expiry_time => { | ||
console.log('Expiry Time:', expiry_time); | ||
}) | ||
.catch(errorHandler); | ||
|
||
coinut.getAssets() | ||
.then(assets => { | ||
console.log('Assets:', assets); | ||
}) | ||
.catch(errorHandler); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters