All Projects → antoniocasero → Kraken

antoniocasero / Kraken

Licence: MIT license
Lightweight wrapper for trading cryptocurrencies using Kraken

Programming Languages

swift
15916 projects
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to Kraken

Krypto Trading Bot
Self-hosted crypto trading bot (automated high frequency market making) written in C++
Stars: ✭ 2,589 (+9146.43%)
Mutual labels:  trade, kraken
Telegram Kraken Bot
Python bot to trade on Kraken via Telegram
Stars: ✭ 156 (+457.14%)
Mutual labels:  trade, kraken
TradeTheEvent
Implementation of "Trade the Event: Corporate Events Detection for News-Based Event-Driven Trading." In Findings of ACL2021
Stars: ✭ 64 (+128.57%)
Mutual labels:  trade
market-maker-bot
MM Bot for OpenDEX. Make profits via arbitrage between OpenDEX and a connected CEX account like Binance 🤖
Stars: ✭ 84 (+200%)
Mutual labels:  kraken
LiquiDEX
2-steps non-interactive atomic swap protocol for Liquid
Stars: ✭ 13 (-53.57%)
Mutual labels:  trade
bitmex-backtest-python
bitmex-backtest is a python library for backtest with bitmex fx trade rest api on Python 3.7 and above.
Stars: ✭ 13 (-53.57%)
Mutual labels:  trade
py-ecomplexity
Python package to compute economic complexity and associated variables
Stars: ✭ 46 (+64.29%)
Mutual labels:  trade
LiuAlgoTrader
Framework for algorithmic trading
Stars: ✭ 514 (+1735.71%)
Mutual labels:  trade
hurtrade
An Open Source Forex Trading Platform
Stars: ✭ 22 (-21.43%)
Mutual labels:  trade
alcor-ui
Alcor Exchange | First self-listing onchain DEX for eosio tokens;
Stars: ✭ 103 (+267.86%)
Mutual labels:  trade
EDCT
EDCT is a tool for large quantity trades in Elite: Dangerous. It is very useful for fleet carrier owners
Stars: ✭ 18 (-35.71%)
Mutual labels:  trade
CryptoTickerBot
A .NET Core program to fetch ticker data from various crypto exchange websites.
Stars: ✭ 30 (+7.14%)
Mutual labels:  kraken
nft-swap-sdk
Ethereum's missing p2p NFT and token swap library for web3 developers. Written in TypeScript. Powered by 0x.
Stars: ✭ 200 (+614.29%)
Mutual labels:  trade
node-zaif
Promise-base Cryptocurrency Exchange zaif.jp API for node.js
Stars: ✭ 19 (-32.14%)
Mutual labels:  trade
recentrifuge
Recentrifuge: robust comparative analysis and contamination removal for metagenomics
Stars: ✭ 79 (+182.14%)
Mutual labels:  kraken
stockbot
Alpaca algo stock trading bot
Stars: ✭ 105 (+275%)
Mutual labels:  trade
java-binance-api
Java Binance API Client
Stars: ✭ 72 (+157.14%)
Mutual labels:  trade
adamant-tradebot
Free market-making software for cryptocurrency projects and exchanges. Makes trade volume, maintains spread and liquidity/depth, set price range, and builds live-like dynamic order book.
Stars: ✭ 113 (+303.57%)
Mutual labels:  trade
coincube
A Python/Vue.js crypto portfolio management and trade automation program with support for 10 exchanges.
Stars: ✭ 85 (+203.57%)
Mutual labels:  trade
guncontrol
🔔 GunControl • Custom *nix launcher for GunBot
Stars: ✭ 16 (-42.86%)
Mutual labels:  kraken

Kraken Swift

IMPORTANT

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!

Description

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

Installation

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Kraken into your Xcode project using Carthage, specify it in your Cartfile:

github "antoniocasero/Kraken" ~> 1.0

Run carthage update to build the framework and drag the built Kraken.framework into your Xcode project.

Manually

If you prefer not to use any of the aforementioned dependency managers, you can integrate Kraken into your project manually.

Embedded Framework

  • Open up Terminal, cd into your top-level project directory, and run the following command "if" your project is not initialized as a git repository:

    $ git init
  • Add Kraken as a git submodule by running the following command:

    $ git submodule add https://github.com/antoniocasero/Kraken.git
  • Open the new Kraken folder, and drag the Kraken.xcodeproj into the Project Navigator of your application's Xcode project.

    It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.

  • Select the Kraken.xcodeproj in the Project Navigator and verify the deployment target matches that of your application target.

  • Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar.

  • In the tab bar at the top of that window, open the "General" panel.

  • Click on the + button under the "Embedded Binaries" section.

  • Select the top Kraken.framework

  • And that's it!

    The Kraken.framework is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.


Usage

Create a Kraken client using your credentials

let credentials = Kraken.Credentials(key: "0Q/eOVRtyfg+WbIuLjKJ.....",
                                     secret: "EVFTYSinNiC89V.....")

let kraken = Kraken(credentials: credentials)

kraken.serverTime(completion: { let _ = $0.map{ print($0) } } // 1393056191

Public Data Methods

Server Time

This functionality is provided by Kraken to to aid in approximating the skew time between the server and client.

 kraken.serverTime { result in
    switch result {
         case .success(let serverTime):
                serverTime["unixtime"] // 1393056191
                serverTime["rfc1123"] // "Sat, 22 Feb 2014 08:28:04 GMT"
         case .failure(let error): print(error)
        }
 }

Asset Info

Returns the assets that can be traded on the exchange. This method can be passed info, aclass (asset class), and asset options. An example below is given for each:

kraken.assets(completion: { let _ = $0.map{ print($0) } })

Asset Pairs

kraken.assetsPairs(completion: { let _ = $0.map{ print($0) } })

Ticker Information

  kraken.ticker(pairs: ["BCHEUR", "BCHUSD"], completion: { let _ = $0.map{ print($0) }  })

Order Book

Get market depth information for given asset pairs

depth_data = kraken.order_book('LTCXRP', completion: { ... })

Trades

Get recent trades

trades = kraken.trades('LTCXRP', completion: { ... })

Spread

Get spread data for a given asset pair

spread = kraken.spread('LTCXRP', completion: { ... })

Private Data Methods

Balance

Get account balance for each asset Note: Rates used for the floating valuation is the midpoint of the best bid and ask prices

kraken.balance(completion: { ... })

Trade Balance

Get account trade balance

kraken.tradeBalance(completion: { ... })

Open Orders

kraken.openOrders(completion: { ... })

Closed Orders

kraken.closedOrders(completion: { ... })

Query Orders

See all orders

kraken.queryOrders(completion: { ... })

Trades History

Get array of all trades

kraken.tradeHistory(completion: { ... })

Query Trades

Input: Array of transaction (tx) ids

kraken.queryTrades(txids:arrayIds completion: { ... })

Open Positions

Input: Array of transaction (tx) ids

kraken.openPositions(txids:arrayIds completion: { ... })

Ledgers Info

kraken.ledgersInfo(completion: { ... })

Ledgers Info

Input: Array of ledger ids

kraken.queryTrades(ids: ledgerIds completion: { ... })

Trade Volume

let assetPairs = ["XLTCXXDG", "ZEURXXDG"]
kraken.queryTrades(ids: assetPairs completion: { ... })

Adding and Cancelling Orders

Add Order

There are 4 required parameters for buying an order. The example below illustrates the most basic order. Please see the Kraken documentation for the parameters required for more advanced order types.

// buying 0.01 XBT (bitcoin) for XRP (ripple) at market price
let opts = [
  "pair": "XBTXRP",
  "type": "buy",
  "ordertype": "market",
  "volume": "0.01"
]

kraken.addOrder(options:opts completion: { ... })

Cancel Order

kraken.cancelOrder(ids:["UKIYSP-9VN27-AJWWYC"] completion: { ... })
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].