Swiftpack.co - TradeWithIt/ByBit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by TradeWithIt.
TradeWithIt/ByBit 1.0.0
Bybit API client
⭐️ 0
🕓 3 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/TradeWithIt/ByBit.git", from: "1.0.0")

ByBit

Swift API connector for Bybit's HTTP and WebSockets APIs.

Mostly implementing USDT Perpetual at this time. Feel free to contiriubte and help build this API.

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/TradeWithIt/ByBit", branch: "main")
]

Usage

create client

let env = env = BybitEnvironment.bybitTestnet(key: appKey, secret: appSecret)
let account = Account(name: name, api: env.api, key: appKey, secret: appSecret)
let bybit = try await BybitClient(.api(account.api, key: account.key, secret: account.secret))

load klines

private(set) var bybit: BybitClient?
let interval: BybitDataRefreshInterval = .fiveMin
let now = bybit.environment.currentServerTime + 12,000
let from = 60,000
let klines = try await bybit.kline(symbol: "USDT", interval: interval, from: Int(now - from))

GitHub

link
Stars: 0
Last commit: 3 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Release 1.0.0
3 weeks ago

Innitial release

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics