-
Notifications
You must be signed in to change notification settings - Fork 23
/
ccxt.php
137 lines (114 loc) · 5.39 KB
/
ccxt.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
/*
MIT License
Copyright (c) 2017 Igor Kroitor
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
//-----------------------------------------------------------------------------
namespace ccxt;
if (defined('PATH_TO_CCXT')) {
return;
}
define('PATH_TO_CCXT', __DIR__ . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR);
define('PATH_TO_WS_CCXT', __DIR__ . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'pro' . DIRECTORY_SEPARATOR);
define('PATH_TO_CCXT_ASYNC', PATH_TO_CCXT . 'async' . DIRECTORY_SEPARATOR);
spl_autoload_register(function ($class) {
// used to include static dependencies
$PATH = PATH_TO_CCXT . 'static_dependencies/';
if (strpos($class, 'kornrunner') !== false) {
$version = phpversion();
if (intval(explode('.', $version)[0]) < 7) {
throw new \RuntimeException($class . " requires php7 or greater, your version: " . $version);
}
}
$class_name = str_replace('kornrunner\\Solidity', 'kornrunner/solidity/src/Solidity', $class);
$class_name = str_replace('kornrunner\\Keccak', 'kornrunner/keccak/src/Keccak', $class_name);
$class_name = str_replace('Elliptic\\', 'elliptic-php/lib/', $class_name);
$class_name = str_replace('\\', DIRECTORY_SEPARATOR, $class_name);
$file = $PATH . $class_name . '.php';
if (file_exists($file)) {
require_once $file;
}
});
require_once PATH_TO_CCXT . 'BaseError.php';
require_once PATH_TO_CCXT . 'ExchangeError.php';
require_once PATH_TO_CCXT . 'AuthenticationError.php';
require_once PATH_TO_CCXT . 'PermissionDenied.php';
require_once PATH_TO_CCXT . 'AccountNotEnabled.php';
require_once PATH_TO_CCXT . 'AccountSuspended.php';
require_once PATH_TO_CCXT . 'ArgumentsRequired.php';
require_once PATH_TO_CCXT . 'BadRequest.php';
require_once PATH_TO_CCXT . 'BadSymbol.php';
require_once PATH_TO_CCXT . 'MarginModeAlreadySet.php';
require_once PATH_TO_CCXT . 'BadResponse.php';
require_once PATH_TO_CCXT . 'NullResponse.php';
require_once PATH_TO_CCXT . 'InsufficientFunds.php';
require_once PATH_TO_CCXT . 'InvalidAddress.php';
require_once PATH_TO_CCXT . 'AddressPending.php';
require_once PATH_TO_CCXT . 'InvalidOrder.php';
require_once PATH_TO_CCXT . 'OrderNotFound.php';
require_once PATH_TO_CCXT . 'OrderNotCached.php';
require_once PATH_TO_CCXT . 'CancelPending.php';
require_once PATH_TO_CCXT . 'OrderImmediatelyFillable.php';
require_once PATH_TO_CCXT . 'OrderNotFillable.php';
require_once PATH_TO_CCXT . 'DuplicateOrderId.php';
require_once PATH_TO_CCXT . 'NotSupported.php';
require_once PATH_TO_CCXT . 'NetworkError.php';
require_once PATH_TO_CCXT . 'DDoSProtection.php';
require_once PATH_TO_CCXT . 'RateLimitExceeded.php';
require_once PATH_TO_CCXT . 'ExchangeNotAvailable.php';
require_once PATH_TO_CCXT . 'OnMaintenance.php';
require_once PATH_TO_CCXT . 'InvalidNonce.php';
require_once PATH_TO_CCXT . 'RequestTimeout.php';
require_once PATH_TO_WS_CCXT . 'ClientTrait.php';
require_once PATH_TO_CCXT . 'Precise.php';
require_once PATH_TO_CCXT . 'Exchange.php';
require_once PATH_TO_CCXT_ASYNC . 'Exchange.php';
$autoloadFile = __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
if (file_exists($autoloadFile)) {
require_once $autoloadFile;
}
spl_autoload_register(function ($class_name) {
$sections = explode("\\", $class_name);
if (in_array("ccxt\\pro",$sections)) {
$class_name = str_replace("ccxt\\pro\\", "", $class_name);
$sections = explode("\\", $class_name);
$class_name = str_replace ("ccxt\\pro\\", "", $class_name);
$file = PATH_TO_WS_CCXT . $class_name . '.php';
if (file_exists ($file)) {
require_once $file;
}
return;
}
$class_name = str_replace("ccxt\\", "", $class_name);
$sections = explode("\\", $class_name);
$file = PATH_TO_CCXT . implode(DIRECTORY_SEPARATOR, $sections) . '.php';
if (file_exists($file)) {
require_once $file;
}
});
// require_once __DIR__ . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'pro.php';
namespace ccxt\pro;
require_once PATH_TO_WS_CCXT . 'Future.php';
require_once PATH_TO_WS_CCXT . 'Client.php';
require_once PATH_TO_WS_CCXT . 'OrderBook.php';
require_once PATH_TO_WS_CCXT . 'OrderBookSide.php';
require_once PATH_TO_WS_CCXT . 'BaseCache.php';
require_once PATH_TO_WS_CCXT . 'ArrayCache.php';
require_once PATH_TO_WS_CCXT . 'ArrayCacheByTimestamp.php';
require_once PATH_TO_WS_CCXT . 'ArrayCacheBySymbolById.php';
require_once PATH_TO_WS_CCXT . 'Exchange.php';