Objective C client library for the meXBT exchange API
To run the example project, clone the repo, and run pod install
from the Example directory first.
[MexbtClient productPairs];
[MexbtClient ticker:@"BTCMXN"];
[MexbtClient trades:@"BTCMXN" startIndex:-1 count:20];
[MexbtClient tradesByDate:@"BTCMXN" startDate:1416530012 endDate:1416559390];
[MexbtClient orderBook:@"BTCMXN"];
MexbtClient *client = [[MexbtClient alloc] init];
client.privateKey = @"<YOUR PRIVATE KEY>";
client.publicKey = @"<YOUR PUBLIC KEY>";
client.userId = @"<YOUR USER ID / EMAIL";
client.isSandbox = YES;
[client createMarketOrder:@"BTCUSD" side:@"buy" qty:@1.0 px:@342.99];
[client createLimitOrder:@"BTCUSD" side:@"buy" qty:@1.0 px:@342.99];
NSDictionary *order = [client createOrder:@"BTCUSD" side:@"buy" orderType:0 qty:@1.0 px:@342.99];
NSInteger orderId = [order[@"serverOrderId"] integerValue];
[client modifyOrder:@"BTCUSD" serverOrderId:orderId modifyAction:1];
[client moveOrderToTop:@"BTCUSD" serverOrderId:orderId];
[client executeOrder:@"BTCUSD" serverOrderId:orderId];
[client cancelOrder:@"BTCUSD" serverOrderId:orderId];
[client cancelAll:@"BTCUSD"];
[client accountInfo];
[client balance];
[client accountTrades:@"BTCUSD" startIndex:-1 count:20];
[client orders];
[client depositAddresses];
[client depositAddress:@"BTC"]
[client withdraw:@"BTC" amount:@1.123456 sendToAddress:@"address"];
MexbtClient is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "MexbtClient"
pod "IGDigest", "~> 1.1"
- All functions return
(NSDictionary *)
except fordepositAddress
which returns(NSString *)
. - All functions return
nil
when meXBT API returns with HTTP status code other than200
or returns non-json or empty response. - Unfortunately, for some implementation details boolean json values (e.g:
true
,false
) are stored as(NSNumber *)
using0
forfalse
and1
fortrue
. So if if you want to get theBOOL
of an(NSNumber *) x
, you would use[x boolValue]
- All functions assume that meXBT API will respond with the expected format as specified in meXBT APIs documentation: 1)Public API. 2)Private API, otherwise some exceptions will be thrown; please, keep that in mind when you find some unexpcted behavior in your code.
For convenience you can install the lib in any XCode from the Github repo directly.
This only makes sense when you are working on the lib not when your are using it, in which case you should do as specified in Installation section above.
You can do that by adding the following to Podfile
.
pod 'MexbtClient', :git => 'https://github.com/Ahimta/mexbt-objective-c.git'
pod 'IGDigest', '~> 1.1'
git clone https://github.com/Ahimta/mexbt-objective-c.git
cd mexbt-objective-c/Example
pod install
Then open mexbt-objective-c/Example/MexbtClient.xcworkspace
in XCode.
The library consists primarily of three files (the rest is mostly generated by CocoaPods):
- mexbt-objective-c/Pod/Classes/MexbtClient.h
- mexbt-objective-c/Pod/Classes/MexbtClient.m
- mexbt-objective-c/Example/Tests/Tests.m
Abdullah Alansari, ahimta@gmail.com
MexbtClient is available under the MIT license. See the LICENSE file for more info.