Skip to content

Commit ae5fae1

Browse files
committed
added restUrl and wsUrl, updated logo
1 parent c783d2c commit ae5fae1

File tree

3 files changed

+44
-3
lines changed

3 files changed

+44
-3
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<p align="center">
2-
<a href="https://bitvavo.com"><img src="https://bitvavo.com/media/images/logo/bitvavoGeneral.svg" width="600" title="Bitvavo Logo"></a>
2+
<br>
3+
<a href="https://bitvavo.com"><img src="https://bitvavo.com/assets/static/ext/logo-shape.svg" width="100" title="Bitvavo Logo">
34
</p>
45

56
# PHP Bitvavo API
@@ -185,6 +186,9 @@ foreach ($bitvavo->assets([]) as $asset) {
185186
"withdrawalFee": "0.2",
186187
"withdrawalMinAmount": "0.2",
187188
"withdrawalStatus": "OK",
189+
"networks": [
190+
"Mainnet"
191+
],
188192
"message": ""
189193
}
190194
{
@@ -197,6 +201,9 @@ foreach ($bitvavo->assets([]) as $asset) {
197201
"withdrawalFee": "2",
198202
"withdrawalMinAmount": "2",
199203
"withdrawalStatus": "OK",
204+
"networks": [
205+
"Mainnet"
206+
],
200207
"message": ""
201208
}
202209
{
@@ -209,6 +216,9 @@ foreach ($bitvavo->assets([]) as $asset) {
209216
"withdrawalFee": "3",
210217
"withdrawalMinAmount": "3",
211218
"withdrawalStatus": "",
219+
"networks": [
220+
"Mainnet"
221+
],
212222
"message": ""
213223
}
214224
{
@@ -221,6 +231,9 @@ foreach ($bitvavo->assets([]) as $asset) {
221231
"withdrawalFee": "2",
222232
"withdrawalMinAmount": "2",
223233
"withdrawalStatus": "OK",
234+
"networks": [
235+
"Mainnet"
236+
],
224237
"message": ""
225238
}
226239
...
@@ -1277,6 +1290,9 @@ $websock->assets([], function($response) {
12771290
"withdrawalFee": "0.2",
12781291
"withdrawalMinAmount": "0.2",
12791292
"withdrawalStatus": "OK",
1293+
"networks": [
1294+
"Mainnet"
1295+
],
12801296
"message": ""
12811297
}
12821298
{
@@ -1289,6 +1305,9 @@ $websock->assets([], function($response) {
12891305
"withdrawalFee": "2",
12901306
"withdrawalMinAmount": "2",
12911307
"withdrawalStatus": "OK",
1308+
"networks": [
1309+
"Mainnet"
1310+
],
12921311
"message": ""
12931312
}
12941313
{
@@ -1301,6 +1320,9 @@ $websock->assets([], function($response) {
13011320
"withdrawalFee": "3",
13021321
"withdrawalMinAmount": "3",
13031322
"withdrawalStatus": "",
1323+
"networks": [
1324+
"Mainnet"
1325+
],
13041326
"message": ""
13051327
}
13061328
{
@@ -1313,6 +1335,9 @@ $websock->assets([], function($response) {
13131335
"withdrawalFee": "2",
13141336
"withdrawalMinAmount": "2",
13151337
"withdrawalStatus": "OK",
1338+
"networks": [
1339+
"Mainnet"
1340+
],
13161341
"message": ""
13171342
}
13181343
...

bitvavo.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,12 @@ function errorToConsole($message) {
6868

6969
class Bitvavo {
7070
public function __construct($options) {
71-
$this->base = "https://api.bitvavo.com/v2";
7271
$apiKeySet = false;
7372
$apiSecretSet = false;
7473
$accessWindowSet = false;
7574
$debuggingSet = false;
75+
$restUrlSet = false;
76+
$wsUrlSet = false;
7677
foreach ($options as $key => $value) {
7778
if(strtolower($key) == "apikey") {
7879
$this->apiKey = $value;
@@ -86,6 +87,12 @@ public function __construct($options) {
8687
} else if(strtolower($key) == "debugging") {
8788
$this->debugging = (bool)$value;
8889
$debuggingSet = true;
90+
} else if(strtolower($key) === 'resturl') {
91+
$this->base = $value;
92+
$restUrlSet = true;
93+
} else if(strtolower($key) === 'wsurl') {
94+
$this->wsurl = $value;
95+
$wsUrlSet = true;
8996
}
9097
}
9198
if(!$apiKeySet) {
@@ -100,6 +107,12 @@ public function __construct($options) {
100107
if(!$debuggingSet) {
101108
$this->debugging = false;
102109
}
110+
if(!$restUrlSet) {
111+
$this->base = "https://api.bitvavo.com/v2";
112+
}
113+
if(!$wsUrlSet) {
114+
$this->wsurl = "wss://ws.bitvavo.com/v2/";
115+
}
103116
}
104117

105118
public function newWebSocket($reconnect = false, $publicCommandArray = null, $privateCommandArray = null, $oldSocket = null) {
@@ -342,6 +355,7 @@ function sortAndInsert($update, $book, $sortFunc) {
342355
class Websocket {
343356
public function __construct($bitvavo = null, $reconnect = false, $publicCommandArray, $privateCommandArray, $oldSocket) {
344357
$this->parent = $bitvavo;
358+
$this->wsurl = $bitvavo->wsurl;
345359
$this->apiKey = $bitvavo->apiKey;
346360
$this->apiSecret = $bitvavo->apiSecret;
347361
$this->accessWindow = $bitvavo->accessWindow;
@@ -387,7 +401,7 @@ public function __construct($bitvavo = null, $reconnect = false, $publicCommandA
387401
$reactConnector = new React\Socket\Connector($loop, []);
388402
$connector = new Ratchet\Client\Connector($loop, $reactConnector);
389403

390-
$connector('wss://ws.bitvavo.com/v2/')->then(function(Ratchet\Client\WebSocket $conn) {
404+
$connector($this->wsurl)->then(function(Ratchet\Client\WebSocket $conn) {
391405

392406
$this->reconnectTimer = 1;
393407
$this->conn = $conn;

example/example.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ function main() {
1515
$bitvavo = new Bitvavo([
1616
"APIKEY" => "<APIKEY>",
1717
"APISECRET" => "<APISECRET>",
18+
"RESTURL" => "https://api.bitvavo.com/v2",
19+
"WSURL" => "wss://ws.bitvavo.com/v2/",
1820
"ACCESSWINDOW" => 10000,
1921
"DEBUGGING" => false
2022
]);

0 commit comments

Comments
 (0)