-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.php
40 lines (28 loc) · 1.09 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
include('itbitApi.php');
$api_endpoint_beta = "https://beta-api.itbit.com/v1";
$api_endpoint_prod = "https://api.itbit.com/v1";
$api_key = "api-key";
$api_secret = "api-secret";
$user_id = "your-user-id";
$client = new itbitApi($api_endpoint_beta, $api_key, $api_secret, $user_id);
// Public Api ----------------------------------------------------------------------------------------
echo "Show Tickers: \n";
print_r( $client->getTickers('XBTUSD') );
echo "\n ------------ \n";
// Private Api ----------------------------------------------------------------------------------------
// Get All Wallets
foreach( $client->getAllWallets() as $wallet_info){
// get the first funded wallet
if($wallet_info->balances[0]->availableBalance > 0.00){
$funded_wallet = $wallet_info;
}
}
// Show the funded wallet details
echo "Show Wallets Details\n";
print_r($funded_wallet);
echo "\n ------------ \n";
echo "-- Create New Buy Order -- \n";
echo ">> Order Details: \n";
$newOrder = $client->createOrder($funded_wallet->id, 'buy', 'limit', 'XBT', '0.01', '120.12', 'XBTUSD');
print_r($newOrder);