Skip to content
This repository was archived by the owner on Dec 1, 2025. It is now read-only.

Commit 6d118b7

Browse files
committed
Migrated to PSR7. Seperated API clases
1 parent 4e067ff commit 6d118b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1226
-1686
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
vendor
22
composer.lock
3-
.idea
43
build
5-
phpunit.xml
4+
phpunit.xml
5+
.phpunit.result.cache

.travis.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
language: php
22

33
php:
4-
- '7.1'
4+
- '7.2'
5+
- '7.3'
6+
- '7.4'
57

6-
# faster builds on new travis setup not using sudo
78
sudo: false
89

9-
# cache vendor dirs
1010
cache:
1111
directories:
1212
- $HOME/.composer/cache
@@ -16,15 +16,22 @@ install:
1616
- travis_retry composer update --dev --prefer-dist --no-interaction
1717

1818
before_script:
19-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
20-
- chmod +x ./cc-test-reporter
21-
- if [ $(phpenv version-name) = "7.1" ]; then ./cc-test-reporter before-build; fi
19+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
20+
- chmod +x ./cc-test-reporter
21+
- ./cc-test-reporter before-build
2222

2323
script:
2424
- composer validate --strict
2525
- vendor/bin/phpunit
2626

2727
after_script:
28-
- if [ $(phpenv version-name) = "7.1" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
28+
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
2929
- wget https://scrutinizer-ci.com/ocular.phar
30-
- php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml
30+
- php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml
31+
32+
notifications:
33+
email:
34+
recipients:
35+
- codenix.sv@gmail.com
36+
on_success: never
37+
on_failure: always

LICENSE

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
1-
BSD 3-Clause License
1+
MIT License
22

3-
Copyright (c) 2017, Vladymyr Svyryd
4-
All rights reserved.
3+
Copyright (c) 2017 Volodymyr Svyryd
54

6-
Redistribution and use in source and binary forms, with or without
7-
modification, are permitted provided that the following conditions are met:
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
811

9-
* Redistributions of source code must retain the above copyright notice, this
10-
list of conditions and the following disclaimer.
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
1114

12-
* Redistributions in binary form must reproduce the above copyright notice,
13-
this list of conditions and the following disclaimer in the documentation
14-
and/or other materials provided with the distribution.
15-
16-
* Neither the name of the copyright holder nor the names of its
17-
contributors may be used to endorse or promote products derived from
18-
this software without specific prior written permission.
19-
20-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 74 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
# bittrex-api
2-
[![Build Status](https://travis-ci.org/codenix-sv/bittrex-api.svg?branch=master)](https://travis-ci.org/codenix-sv/bittrex-api)
3-
[![Maintainability](https://api.codeclimate.com/v1/badges/49b696439195269120b4/maintainability)](https://codeclimate.com/github/codenix-sv/bittrex-api/maintainability)
4-
[![Test Coverage](https://api.codeclimate.com/v1/badges/49b696439195269120b4/test_coverage)](https://codeclimate.com/github/codenix-sv/bittrex-api/test_coverage)
2+
[![Build Status](https://travis-ci.com/codenix-sv/bittrex-api.svg?branch=master)](https://travis-ci.com/codenix-sv/bittrex-api)
53
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/codenix-sv/bittrex-api/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/codenix-sv/bittrex-api/?branch=master)
6-
[![Code Coverage](https://scrutinizer-ci.com/g/codenix-sv/bittrex-api/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/codenix-sv/bittrex-api/?branch=master)
7-
[![Code Intelligence Status](https://scrutinizer-ci.com/g/codenix-sv/bittrex-api/badges/code-intelligence.svg?b=master)](https://scrutinizer-ci.com/code-intelligence)
8-
9-
[![License](https://poser.pugx.org/codenix-sv/bittrex-api/license)](https://packagist.org/packages/codenix-sv/bittrex-api)
10-
[![Latest Stable Version](https://poser.pugx.org/codenix-sv/bittrex-api/v/stable)](https://packagist.org/packages/codenix-sv/bittrex-api)
4+
[![Test Coverage](https://api.codeclimate.com/v1/badges/49b696439195269120b4/test_coverage)](https://codeclimate.com/github/codenix-sv/bittrex-api/test_coverage)
5+
[![Maintainability](https://api.codeclimate.com/v1/badges/49b696439195269120b4/maintainability)](https://codeclimate.com/github/codenix-sv/bittrex-api/maintainability)
6+
[![License: MIT](https://img.shields.io/github/license/codenix-sv/bittrex-api)](https://github.com/codenix-sv/bittrex-api/blob/master/LICENSE)
7+
![Packagist](https://img.shields.io/packagist/dt/codenix-sv/bittrex-api)
118

12-
A simple PHP wrapper for [Bittrex API](https://bittrex.com/Home/Api). Bittrex is the next generation crypto trading platform.
9+
A simple PHP wrapper for [Bittrex API](https://bittrex.github.io/api/v1-1). Bittrex is the next generation crypto trading platform.
1310

1411
## Requirements
1512

16-
- PHP >= 7.1
17-
- [Bittrex account](https://bittrex.com), API key and API secret
13+
* PHP >= 7.2
14+
* ext-json
15+
* [Bittrex account](https://global.bittrex.com/), API key and API secret
1816

1917
## Installation
2018

@@ -23,12 +21,12 @@ The preferred way to install this extension is through [composer](http://getcomp
2321
Either run
2422

2523
```bash
26-
$ composer require codenix-sv/bittrex-api:~0.2
24+
$ composer require codenix-sv/bittrex-api
2725
```
2826
or add
2927

3028
```json
31-
"codenix-sv/bittrex-api" : "~0.2"
29+
"codenix-sv/bittrex-api" : "^1.0"
3230
```
3331

3432
to the require section of your application's `composer.json` file.
@@ -37,104 +35,119 @@ to the require section of your application's `composer.json` file.
3735

3836
### Example
3937
```php
40-
use codenixsv\Bittrex\BittrexManager;
38+
use Codenixsv\BittrexApi\BittrexClient;
4139

42-
$manager = new BittrexManager('API_KEY', 'API_SECRET');
43-
$client = $manager->createClient();
40+
$client = new BittrexClient();
41+
$client->setCredential('API_KEY', 'API_SECRET');
4442

45-
$responce = $client->getBalances();
43+
$data = $client->public()->getMarkets();
4644
```
47-
### Available methods
45+
## Available methods
4846

49-
#### Public API
47+
### Public API
5048

51-
##### Get the open and available trading markets
49+
#### Get the open and available trading markets
5250
```php
53-
$responce = $client->getMarkets();
51+
$data = $client->public()->getMarkets();
5452
```
55-
##### Get all supported currencies
53+
54+
#### Get all supported currencies
5655
```php
57-
$responce = $client->getCurrencies();
56+
$data = $client->public()->getCurrencies();
5857
```
59-
##### Get the current tick values for a market
58+
59+
#### Get the current tick values for a market
6060
```php
61-
$responce = $client->getTicker('BTC-LTC');
61+
$data = $client->public()->getTicker('BTC-LTC');
6262
```
63-
##### Get the last 24 hour summary of all active exchanges
63+
#### Get the last 24 hour summary of all active exchanges
6464
```php
65-
$responce = $client->getMarketSummaries();
65+
$data = $client->public()->getMarketSummaries();
6666
```
67-
##### Get the last 24 hour summary of all active exchanges for a market
67+
68+
#### Get the last 24 hour summary of all active exchanges for a market
6869
```php
69-
$responce = $client->getMarketSummary('BTC-LTC');
70+
$data = $client->public()->getMarketSummary('BTC-LTC');
7071
```
71-
##### Get the orderbook for a given market
72+
73+
#### Get the orderbook for a given market
7274
```php
73-
$responce = $client->getOrderBook('BTC-LTC');
75+
$data = $client->public()->getOrderBook('BTC-LTC');
7476
```
75-
##### Get latest trades that have occurred for a specific market
77+
78+
#### Get latest trades that have occurred for a specific market
7679
```php
77-
$responce = $client->getMarketHistory('BTC-LTC');
80+
$data = $client->public()->getMarketHistory('BTC-LTC');
7881
```
7982

80-
#### Market API
83+
### Market API
8184

82-
##### Place a buy order in a specific market
85+
#### Place a buy order in a specific market
8386
```php
84-
$responce = $client->buyLimit('BTC-LTC', 1.2, 1.3);
87+
$data = $client->market()->buyLimit('BTC-LTC', 1.2, 1.3);
8588
```
86-
##### Place a sell order in a specific market
89+
90+
#### Place a sell order in a specific market
8791
```php
88-
$responce = $client->sellLimit('BTC-LTC', 1.2, 1.3);
92+
$data = $client->market()->sellLimit('BTC-LTC', 1.2, 1.3);
8993
```
90-
##### Cancel a buy or sell order
94+
95+
#### Cancel a buy or sell order
9196
```php
92-
$responce = $client->cancel('251c48e7-95d4-d53f-ad76-a7c6547b74ca9');
97+
$data = $client->market()->cancel('251c48e7-95d4-d53f-ad76-a7c6547b74ca9');
9398
```
94-
##### Get all orders that you currently have opened
99+
100+
#### Get all orders that you currently have opened
95101
```php
96-
$responce = $client->getOpenOrders('BTC-LTC');
102+
$data = $client->market()->getOpenOrders('BTC-LTC');
97103
```
98104

99-
#### Account API
105+
### Account API
100106

101-
##### Get all balances from your account
107+
#### Get all balances from your account
102108
```php
103-
$responce = $client->getBalances();
109+
$data = $client->account()->getBalances();
104110
```
105-
##### Get balance from your account for a specific currency
111+
112+
#### Get balance from your account for a specific currency
106113
```php
107-
$responce = $client->getBalance('BTC');
114+
$data = $client->account()->getBalance('BTC');
108115
```
109-
##### Get or generate an address for a specific currency
116+
117+
#### Get or generate an address for a specific currency
110118
```php
111-
$responce = $client->getDepositAddress('BTC');
119+
$data = $client->account()->getDepositAddress('BTC');
112120
```
113-
##### Withdraw funds from your account
121+
122+
#### Withdraw funds from your account
114123
```php
115-
$responce = $client->withdraw('BTC', 20.40, 'EAC_ADDRESS');
124+
$data = $client->account()->withdraw('BTC', 20.40, 'EAC_ADDRESS');
116125
```
117-
##### Get a single order by uuid
126+
127+
#### Get a single order by uuid
118128
```php
119-
$responce = $client->getOrder('251c48e7-95d4-d53f-ad76-a7c6547b74ca9');
129+
$data = $client->account()->getOrder('251c48e7-95d4-d53f-ad76-a7c6547b74ca9');
120130
```
121-
##### Get order history
131+
132+
#### Get order history
122133
```php
123-
$responce = $client->getOrderHistory('BTC-LTC');
134+
$data = $client->account()->getOrderHistory('BTC-LTC');
124135
```
125-
##### Get withdrawal history
136+
137+
#### Get withdrawal history
126138
```php
127-
$responce = $client->getWithdrawalHistory('BTC');
139+
$data = $client->account()->getWithdrawalHistory('BTC');
128140
```
129-
##### Get deposit history
141+
142+
#### Get deposit history
130143
```php
131-
$responce = $client->getDepositHistory('BTC');
144+
$data = $client->account()->getDepositHistory('BTC');
132145
```
133146

134147
## Further Information
135-
Please, check the [Bittrex site](https://bittrex.com/Home/Api) documentation for further
148+
Please, check the [Bittrex site](https://bittrex.github.io/api/v1-1) documentation for further
136149
information about API.
137150

138151
## License
139152

140-
**bittrex-api** is released under the BSD 3-Clause License. See the bundled [LICENSE](./LICENSE) for details.
153+
`codenix-sv/bittrex-api` is released under the MIT License. See the bundled [LICENSE](./LICENSE) for details.

composer.json

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,35 @@
11
{
22
"name": "codenix-sv/bittrex-api",
3-
"description": "PHP client for the Bittrex API",
4-
"keywords": [
5-
"bittrex",
6-
"bitcoin",
7-
"btc",
8-
"bittrex-api"
9-
],
103
"type": "library",
11-
"license": "BSD-3-Clause",
4+
"description": "PHP client for Bittrex API",
5+
"homepage": "https://github.com/codenix-sv/bittrex-api",
6+
"keywords": ["client", "api", "php", "bittrex", "rest", "bittrex-api", "exchange"],
7+
"license": "MIT",
128
"support": {
13-
"issues": "https://github.com/codenix-sv/bittrex-api/issues?state=open",
14-
"source": "https://github.com/codenix-sv/bittrex-api"
15-
},
9+
"issues": "https://github.com/codenix-sv/bittrex-api/issues?state=open",
10+
"source": "https://github.com/codenix-sv/bittrex-api"
11+
},
1612
"authors": [
1713
{
18-
"name": "Vladymyr Svyryd",
14+
"name": "Volodymyr Svyryd",
1915
"email": "codenix.sv@gmail.com",
2016
"role": "Developer"
2117
}
2218
],
2319
"require": {
24-
"php": ">=7.1"
20+
"php": "^7.2",
21+
"ext-json": "*"
22+
2523
},
2624
"require-dev": {
27-
"phpunit/phpunit": "~6.0"
25+
"phpunit/phpunit": "^8.0",
26+
"guzzlehttp/guzzle": "~6.0"
2827
},
2928
"autoload": {
30-
"psr-4": {
31-
"codenixsv\\Bittrex\\": "src/"
32-
}
29+
"psr-4": { "Codenixsv\\BittrexApi\\": "src/" }
3330
},
3431
"autoload-dev": {
35-
"psr-4": {
36-
"codenixsv\\Bittrex\\": "tests/"
37-
}
38-
}
32+
"psr-4": { "Codenixsv\\BittrexApi\\Tests\\": "tests/"}
33+
},
34+
"prefer-stable": true
3935
}

0 commit comments

Comments
 (0)