Latest 0.1.1
Homepage https://github.com/bitsoex/bitso-ios-sdk
License MIT
Platforms ios 8.0
Dependencies AFNetworking, Mantle
Authors

Version
License
Platform

Bitso Credentials

From a terminal:

  • cd directory
  • Pod install
  • export CLIENT_ID=YOUR_CLIENT_ID
  • export API_KEY=YOUR_API_KEY
  • export API_SECRET=YOUR_API_SECRET
  • open -a xcode
  • From Xcode, open Bitso.xcworkspace

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

Bitso is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "Bitso"

API Usage

BitsoAPI *bitsoAPI = [BitsoAPI APIWithClientID:CLIENT_ID APIKey:API_KEY APISecret:API_SECRET];

Public Endpoints

Ticker

[bitsoAPI getTickerForBook:@"btc_mxn" successBlock:^(BTSTickerModel *ticker) {
    NSLog(@"Last Price:%@", [ticker.last stringValue])
  } failureBlock:^(NSError *error) {
    NSLog(@"Error: %@ %@", error, [error userInfo]);
}];

Transactions

[bitsoAPI getTransactionsFromBook:@"btc_mxn" forTimeRange:@"hour" successBlock:^(NSArray *trades) {
    for (BitsoTrade* trade in trades) {
      NSLog(@"amount:%@, side:%@, price:%@", [trade.amount stringValue], trade.side, [trade.price stringValue]);
    }
  } failureBlock:^(NSError *error) {
    NSLog(@"Error: %@ %@", error, [error userInfo]);
}];

Order Book

[bitsoAPI getOrderBook:@"btc_mxn" withGrouping:YES successBlock:^(BTSOrderBookModel *orderbook) {
    for (NSArray *ask in orderbook.asks) {
      NSLog(@"%@ @ %@", [ask[1] stringValue], [ask[0] stringValue]);
    }
  } failureBlock:^(NSError *error) {
    NSLog(@"Error: %@ %@", error, [error userInfo]);
}];

Private Endpoints

Balance

[bitsoAPI getBalanceWithSuccessBlock:^(BTSBalanceModel *balance) {
    NSLog(@"BTC balance:%@", [balance.btc_balance stringValue]);
  } failureBlock:^(NSError *error) {
    NSLog(@"Error: %@ %@", error, [error userInfo]);
}];

User Transactions

[bitsoAPI getUserTransactionsFromBook:@"btc_mxn" offset:nil limit:nil sort:nil successBlock:^(NSArray *utxs) {
    for (BitsoUserTransaction* transaction in utxs) {
      NSLog(@"datetime:%@", [transaction.datetime stringValue]);
    }
  } failureBlock:^(NSError *error) {
    NSLog(@"Error: %@ %@", error, [error userInfo]);
}];

Open Orders

[bitsoAPI getOpenOrdersFromBook:@"btc_mxn" successBlock:^(NSArray *orders) {
    for (BTSOrderModel *order in orders) {
      NSLog(@"oid:%@", transaction.oid);
    }
  } failureBlock:^(NSError *error) {
      NSLog(@"Error: %@ %@", error, [error userInfo]);
}];

 Lookup Order

[bitsoAPI lookupOrderWithOrderID:ORDER_ID successBlock:^(BTSOrderModel *order) {
    NSLog(@"price:%@, amount:%@", [order.price stringValue], [order.amount stringValue]);
} failureBlock:^(NSError *error) {
    NSLog(@"Error: %@ %@", error, [error userInfo]);
}];

 Cancel Order

[bitsoAPI  cancelOrderWithOrderID:ORDER_ID successBlock:^(NSString *response) {
    NSLog(@"%@", response);
} failureBlock:^(NSError *error) {
    NSLog(@"Error: %@ %@", error, [error userInfo]);
}];

Place Buy Order

[bitsoAPI  placeBuyOrderInBook:BOOK
                        amount:AMOUNT
                         price:PRICE
                  successBlock:^(BTSOrderModel *order) {
      NSLog(@"price:%@, amount:%@", [order.price stringValue], [order.amount stringValue]);
} failureBlock:^(NSError *error) {
      NSLog(@"Error: %@ %@", error, [error userInfo]);
}];

Place Sell Order

[bitsoAPI  placeSellOrderInBook:BOOK
                         amount:AMOUNT
                          price:PRICE
                   successBlock:^(BTSOrderModel *order) {
      NSLog(@"price:%@, amount:%@", [order.price stringValue], [order.amount stringValue]);
} failureBlock:^(NSError *error) {
      NSLog(@"Error: %@ %@", error, [error userInfo]);
}];

Get Bitcoin deposit address

[bitsoAPI getBitcoinDepositAddressWithSuccessBlock:^(NSString *response) {
    NSLog("%@", response);
} failureBlock:^(NSError *error) {
    NSLog(@"Error: %@ %@", error, [error userInfo]);
}];

Bitcoin withdrawal

[bitsoAPI bitcoinWithdrawalToAddress:ADDRESS amount:AMOUNT successBlock:^(NSString *response) {
    NSLog("%@", response);
} failureBlock:^(NSError *error) {
    NSLog(@"Error: %@ %@", error, [error userInfo]);
}];

Ripple withdrawal

[bitsoAPI rippleWithdrawalOfCurrency:CURRENCY toAddress:ADDRESS amount:AMOUNT successBlock:^(NSString *response) {
    NSLog("%@", response);
} failureBlock:^(NSError *error) {
    NSLog(@"Error: %@ %@", error, [error userInfo]);
}];

Bank withdrawal

[bitsoAPI bankWithdrawalForAmount:AMOUNT recipientGivenNames:GIVEN_NAMES familyNames:FAMILY_NAMES clabe:CLABE_SPEI notesRef:@"" numericRef:@"" successBlock:^(NSString *response) {
    NSLog("%@", response);
} failureBlock:^(NSError *error) {
    NSLog(@"Error: %@ %@", error, [error userInfo]);
}];

Author

Mario Romero, [email protected]

Copyright © 2016 Bitso SAPI de CV. All rights reserved.

License

Bitso is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Bitso",
    "version": "0.1.1",
    "summary": "Bitso iOS SDK",
    "description": "Bitcoin Wallet and Exchange integration for iOS apps with Bitso.",
    "homepage": "https://github.com/bitsoex/bitso-ios-sdk",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Mario Romero": "[email protected]"
    },
    "source": {
        "git": "https://github.com/bitsoex/bitso-ios-sdk.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Bitso/Classes/**/*",
    "dependencies": {
        "AFNetworking": [],
        "Mantle": []
    }
}

Pin It on Pinterest

Share This