This Library is heavily inspired by Antonio Casero. The original repo can be found here. I added missing endpoints, async/await support and documentation.
Please thoroughly vet everything in the code for yourself before using this lib to buy, sell, or move any of your assets.
PLEASE submit an issue or pull request if you notice any bugs, security holes, or potential improvements. Any help is appreciated!
This library is a wrapper for the Kraken Digital Asset Trading Platform API. Official documentation from Kraken can be found here.
The current version can be used to query public/private data and make trades. Private data queries and trading functionality require use of your Kraken account API keys.
Kraken Swift was built by Antonio Casero
This package is fully documented. The documentation can be found here
To use in your project simply add this to your Package.swift
under dependencies
.
.package(url: "https://github.com/lukepistrol/KrakenAPI.git", .upToNextMajor(from: "1.0.0"))
When using Xcode go to File > Add Packages
and add the following URL:
https://github.com/lukepistrol/KrakenAPI.git
Create a Kraken client using your credentials
import KrakenAPI
let credentials = Kraken.Credentials(apiKey: "YOUR-API-KEY",
privateKey: "YOUR-PRIVATE-KEY")
let kraken = Kraken(credentials: credentials)
Get the server time from the Kraken API server.
kraken.serverTime { result in
switch result {
case .success(let serverTime):
print(serverTime["unixtime"]) // 1393056191
print(serverTime["rfc1123"]) // "Sun, 13 Mar 2022 08:28:04 GMT"
case .failure(let error):
print(error)
}
}
Or using async await:
let result = await kraken.serverTime()
switch result {
case .success(let serverTime):
print(serverTime["unixtime"]) // 1393056191
print(serverTime["rfc1123"]) // "Sun, 13 Mar 2022 08:28:04 GMT"
case .failure(let error):
print(error)
}
See official API documentation here