A Swift package for connecting and trading on crypto exchanges such as Kucoin and Binance via REST.
π° It can calculate the stop and limit prices for a trailing stop strategy based on a set of given input parameters.
Refer to SwiftTrader+TrailingStop.swift
π€ Supports being deployed to Heroku (Linux). Tested with Vapor, which means automated trading by using webhooks and scripts such as the Profit Percentage Tracker (TradingView). #ka-ching! π€
π List of supported APIs:
Kucoin Futures | Explanation | API Documentation |
---|---|---|
SwiftTrader.kucoinFuturesAccountOverview |
Retrieves the overview of a Kucoin Futures account. | https://docs.kucoin.com/futures/#account |
SwiftTrader.kucoinFuturesStopOrderList |
Retrieves the list of un-triggered stop orders. | https://docs.kucoin.com/futures/#get-untriggered-stop-order-list |
SwiftTrader.kucoinFuturesOrderList |
Retrieves the list of active Futures orders. | https://docs.kucoin.com/futures/#get-order-list |
SwiftTrader.kucoinFuturesPlaceStopLimitOrder |
Places a Futures stop limit order. | https://docs.kucoin.com/futures/#place-an-order |
SwiftTrader.kucoinFuturesCancelStopOrders |
Cancels all untriggered Futures stop orders of a given symbol (contract). | https://docs.kucoin.com/futures/#stop-order-mass-cancelation |
SwiftTrader.kucoinFuturesPositionList |
Lists open Futures positions. | https://docs.kucoin.com/futures/#get-position-list |
Kucoin Spot | Explanation | API Documentation |
---|---|---|
SwiftTrader.kucoinSpotListAccounts |
Gets the list of accounts. | https://docs.kucoin.com/#list-accounts |
SwiftTrader.kucoinSpotGetAccount |
Retrieves information for a single account. | https://docs.kucoin.com/#get-an-account |
SwiftTrader.kucoinSpotGetTransferable |
Returns the transferable balance of a specified account. | https://docs.kucoin.com/#get-the-transferable |
SwiftTrader.kucoinSpotPlaceStopLimitOrder |
Places a spot stop limit order. | https://docs.kucoin.com/#place-a-new-order |
SwiftTrader.kucoinSpotOrderList |
Lists active Spot orders. | https://docs.kucoin.com/#list-orders |
SwiftTrader.kucoinSpotStopOrderList |
Lists active Spot stop orders. | https://docs.kucoin.com/#list-stop-orders |
SwiftTrader.kucoinSpotCancelStopOrders |
Cancels all untriggered stop orders of a given symbol (contract). | https://docs.kucoin.com/#cancel-orders |
SwiftTrader.kucoinSpotWebSocketRequestPrivateToken |
Apply for a private token to create a WebSocket connection, subscribe to private topics, and receive private messages (e.g., account balance, open orders, etc.). | https://www.kucoin.com/docs/websocket/basic-info/apply-connect-token/private-channels-authentication-request-required- |
Binance Spot | Explanation | API Documentation |
---|---|---|
SwiftTrader.binanceSpotNewOrder |
Send in a new order. Currently, only MARKET orders are supported (but this can be easily changed). |
https://binance-docs.github.io/apidocs/spot/en/#new-order-trade |
Use Xcode's built-in support for SPM.
or...
In your Package.swift
, add SwiftTrader
as a dependency:
dependencies: [
.package(url: "https://github.com/backslash-f/swift-trader", from: "0.0.1")
]
Associate the dependency with your target:
targets: [
.target(
name: "YourAppName",
dependencies: [
.product(name: "SwiftTrader", package: "swift-trader")
]
)
]
Run: swift build