swyftxwrapper.js is a JavaScript wrapper for the Australian Cryptocurrency trading platform Swyftx's API.
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
npm install swyftxwrapper.js
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)
Assuming wrapper has been instantiated as swyftx
For a comprehensive ordering guide, please click here
const newProfileSettings = {
"data": {
"favouriteAsset": {
"assetId": 3,
"favStatus": true
},
"analyticsOptOut": true,
"toggleSMSRecovery": true
}
}
const response = await swyftx.setAccountSettings(newProfileSettings);
console.log(response);
//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);
const response = await swyftx.compareExchange("coinspot");
console.log(response);
const response = await swyftx.getLatestMessages(limit=100);
console.log(response);
const response = await swyftx.getDetailedInfo("LTC");
console.log(response);
- Refresh Access Token ✅
- Logout ✅
- Get Scope ✅
- Get Keys ✅
- Revoke Key ✅
- Revoke All Keys ✅
None of the Addresses endpoints are supported in the current version, though this may change in the future.
- 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 ✅
- Get Bar Chart ✅
- Get Latest Bars ✅
- Get Chart Settings ✅
- Get Resolve Symbol ✅
Not included in the wrapper as this part of the API is deprecated.
- Request Withdrawal ✅
- Check Withdrawal Permissions ✅
- Get Currency Withdraw History ✅
- Get Currency Deposit History ✅
- Get All Withdraw History ✅
- Get All Deposit History ✅
- Get History ✅
- Get Affiliate Payout History ✅
- Withdrawal Limits ✅
- Get Live Rates ✅
- Get Market Assets ✅
- Get Basic Info ✅
- Get Detailed Info ✅
- Get Pair Exchange Rate ✅
- Place Order ✅
- Dust Order ✅
- Cancel Order ✅
- Get Orders ✅
- Get Recurring Orders ✅
- Get Recurring Order Stats ✅
- Create Recurring Order ✅
- Delete Recurring Order ✅
- Get Comparison ✅
- Get Latest Messages ✅
- Get Latest Announcements ✅