swyftxwrapper.js
v1.4.0
Published
A JavaScript wrapper for the Swyftx Cryptocurrency trading platform API
Downloads
0
Maintainers
Readme
swyftxwrapper.js
swyftxwrapper.js is a JavaScript wrapper for the Australian Cryptocurrency trading platform Swyftx's API.
Note
Please be aware, this package is still in development and does not currently support all endpoints, but it aims to in the near future.
Please scroll towards the bottom of this page to find a list of all of the currently supported endpoints.
If you're having trouble with some of the parameters for specific functions, you can refer to the Swyftx API docs. There is also a Method Reference page that has an ordering guide. All methods will be added to the reference soon.
Since the Swyftx API is still in beta, it is subject to change at any time and the documentation may not always be up to date. Due to this, some of the endpoints in this wrapper may break from time to time, but I aim to fix any breaking changes as quickly as I can. If you notice an issue, feel free to raise it on Github
Installation
npm install swyftxwrapper.js
Usage
To use the package, simply require it and instantiate with your API key. Make sure to generate an access token before making any calls.
In depth endpoint guide - Method Reference
const Swyftx = require("swyftxwrapper.js");
const swyftx = new Swyftx("YOUR_API_KEY");
const main = async () => {
await swyftx.generateRefreshToken();
//Make any calls to the API you'd like... for example
const liteCoinData = await swyftx.getBasicInfo("LTC");
console.log(liteCoinData);
}
main();
For DEMO use, simply set demo to true when instantiating the wrapper
const swyftx = Swyftx("YOUR_API_KEY", demo=true);
Rate Limiting - Turning on autoWaitOnRateLimit will cause the client to retry requests when rate limited until they go through.
const swyftx = Swytfy("YOUR_API_KEY", demo=false, autoWaitOnRateLimit=true)
Example Usage
Assuming wrapper has been instantiated as swyftx
For a comprehensive ordering guide, please click here
Change Profile Settings
const newProfileSettings = {
"data": {
"favouriteAsset": {
"assetId": 3,
"favStatus": true
},
"analyticsOptOut": true,
"toggleSMSRecovery": true
}
}
const response = await swyftx.setAccountSettings(newProfileSettings);
console.log(response);
Place a Market Buy Order
//NOTE that the default buy/sell currency is USD.
//Below is equivalent to 'buy $500 USD worth of Doge coin at the market price'
const response = await swyftx.instantBuy("DOGE", 500);
//To specify the amount in terms of the coin being bought and not fiat, set fiat=false
//Below is equivalent to 'buy 500 Doge coin at the market price'
const reponse = await swyftx.instantBuy("DOGE", 500, fiat=false);
Get Comparative CoinSpot Prices
const response = await swyftx.compareExchange("coinspot");
console.log(response);
Get Latest Messages From Inbox
const response = await swyftx.getLatestMessages(limit=100);
console.log(response);
Get Detailed Info About a Specific Coin
const response = await swyftx.getDetailedInfo("LTC");
console.log(response);
Endpoints Supported
Authentication
- Refresh Access Token ✅
- Logout ✅
- Get Scope ✅
- Get Keys ✅
- Revoke Key ✅
- Revoke All Keys ✅
Addresses
None of the Addresses endpoints are supported in the current version, though this may change in the future.
Account
- Get Profile ✅
- Account Settings ✅
- Get Verification Info ✅
- Get GreenId Verification Info ❌
- Start Email Verification ✅
- Check Email Verification Status ✅
- Check Phone Verification Status
- Start Phone Verification ✅
- Get Affiliation Info ✅
- Get Account Balances ✅
- Set Currency ✅
- Get Statistics ✅
- Get Progress ✅
- Get Promotions ✅
- Get Tax Report ✅
Charts
- Get Bar Chart ✅
- Get Latest Bars ✅
- Get Chart Settings ✅
- Get Resolve Symbol ✅
Charts v2
Not included in the wrapper as this part of the API is deprecated.
Funds
- Request Withdrawal ✅
- Check Withdrawal Permissions ✅
History
- Get Currency Withdraw History ✅
- Get Currency Deposit History ✅
- Get All Withdraw History ✅
- Get All Deposit History ✅
- Get History ✅
- Get Affiliate Payout History ✅
Limits
- Withdrawal Limits ✅
Markets
- Get Live Rates ✅
- Get Market Assets ✅
- Get Basic Info ✅
- Get Detailed Info ✅
Orders
- Get Pair Exchange Rate ✅
- Place Order ✅
- Dust Order ✅
- Cancel Order ✅
- Get Orders ✅
Recurring Orders
- Get Recurring Orders ✅
- Get Recurring Order Stats ✅
- Create Recurring Order ✅
- Delete Recurring Order ✅
Compare
- Get Comparison ✅
Messages
- Get Latest Messages ✅
- Get Latest Announcements ✅