TestsTested | ✓ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Jun 2016 |
Maintained by Mario Romero Zavala.
Depends on: | |
AFNetworking | >= 0 |
Mantle | >= 0 |
From a terminal:
To run the example project, clone the repo, and run pod install
from the Example directory first.
Bitso is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "Bitso"
BitsoAPI *bitsoAPI = [BitsoAPI APIWithClientID:CLIENT_ID APIKey:API_KEY APISecret:API_SECRET];
[bitsoAPI getTickerForBook:@"btc_mxn" successBlock:^(BTSTickerModel *ticker) {
NSLog(@"Last Price:%@", [ticker.last stringValue])
} failureBlock:^(NSError *error) {
NSLog(@"Error: %@ %@", error, [error userInfo]);
}];
[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]);
}];
[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]);
}];
[bitsoAPI getBalanceWithSuccessBlock:^(BTSBalanceModel *balance) {
NSLog(@"BTC balance:%@", [balance.btc_balance stringValue]);
} failureBlock:^(NSError *error) {
NSLog(@"Error: %@ %@", error, [error userInfo]);
}];
[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]);
}];
[bitsoAPI getOpenOrdersFromBook:@"btc_mxn" successBlock:^(NSArray *orders) {
for (BTSOrderModel *order in orders) {
NSLog(@"oid:%@", transaction.oid);
}
} failureBlock:^(NSError *error) {
NSLog(@"Error: %@ %@", error, [error userInfo]);
}];
[bitsoAPI lookupOrderWithOrderID:ORDER_ID successBlock:^(BTSOrderModel *order) {
NSLog(@"price:%@, amount:%@", [order.price stringValue], [order.amount stringValue]);
} failureBlock:^(NSError *error) {
NSLog(@"Error: %@ %@", error, [error userInfo]);
}];
[bitsoAPI cancelOrderWithOrderID:ORDER_ID successBlock:^(NSString *response) {
NSLog(@"%@", response);
} failureBlock:^(NSError *error) {
NSLog(@"Error: %@ %@", error, [error userInfo]);
}];
[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]);
}];
[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]);
}];
[bitsoAPI getBitcoinDepositAddressWithSuccessBlock:^(NSString *response) {
NSLog("%@", response);
} failureBlock:^(NSError *error) {
NSLog(@"Error: %@ %@", error, [error userInfo]);
}];
[bitsoAPI bitcoinWithdrawalToAddress:ADDRESS amount:AMOUNT successBlock:^(NSString *response) {
NSLog("%@", response);
} failureBlock:^(NSError *error) {
NSLog(@"Error: %@ %@", error, [error userInfo]);
}];
[bitsoAPI rippleWithdrawalOfCurrency:CURRENCY toAddress:ADDRESS amount:AMOUNT successBlock:^(NSString *response) {
NSLog("%@", response);
} failureBlock:^(NSError *error) {
NSLog(@"Error: %@ %@", error, [error userInfo]);
}];
[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]);
}];
Mario Romero, [email protected]
Copyright © 2016 Bitso SAPI de CV. All rights reserved.
Bitso is available under the MIT license. See the LICENSE file for more info.