Gateway::trades()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace CryptoMarkets\Binance;
4
5
use CryptoMarkets\Common\Gateway as BaseGateway;
6
7
class Gateway extends BaseGateway
8
{
9
    /**
10
     * Get the default options.
11
     *
12
     * @return array
13
     */
14
    public function getDefaultOptions()
15
    {
16
        return [
17
            'api_key' => null,
18
            'secret'  => null,
19
        ];
20
    }
21
22
    /**
23
     * Get the gateway name.
24
     *
25
     * @return string
26
     */
27
    public function getName()
28
    {
29
        return 'Binance';
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function symbols()
36
    {
37
        return $this->createRequest(Endpoints\Symbol::class);
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function ticker($symbol)
44
    {
45
        return $this->createRequest(Endpoints\Ticker::class, compact(
46
            'symbol'
47
        ));
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function orderBook($symbol, $limit = 50)
54
    {
55
        return $this->createRequest(Endpoints\OrderBook::class, compact(
56
            'symbol', 'limit'
57
        ));
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function trades($symbol, $limit = 50)
64
    {
65
        return $this->createRequest(Endpoints\Trade::class, compact(
66
            'symbol', 'limit'
67
        ));
68
    }
69
70
    /**
71
     * {@inheritdoc}
72
     */
73
    public function balances()
74
    {
75
        return $this->createRequest(Endpoints\Balance::class);
76
    }
77
78
    /**
79
     * {@inheritdoc}
80
     */
81
    public function buy($symbol, $amount, $price)
82
    {
83
        return $this->createRequest(Endpoints\Buy::class, compact(
84
            'symbol', 'amount', 'price'
85
        ));
86
    }
87
88
    /**
89
     * {@inheritdoc}
90
     */
91
    public function sell($symbol, $amount, $price)
92
    {
93
        return $this->createRequest(Endpoints\Sell::class, compact(
94
            'symbol', 'amount', 'price'
95
        ));
96
    }
97
98
    /**
99
     * {@inheritdoc}
100
     */
101
    public function status($symbol, $id)
102
    {
103
        return $this->createRequest(Endpoints\Status::class, compact(
104
            'symbol', 'id'
105
        ));
106
    }
107
108
    /**
109
     * {@inheritdoc}
110
     */
111
    public function cancel($symbol, $id)
112
    {
113
        return $this->createRequest(Endpoints\Cancel::class, compact(
114
            'symbol', 'id'
115
        ));
116
    }
117
118
    /**
119
     * {@inheritdoc}
120
     */
121
    public function openOrders($symbol = null)
122
    {
123
        return $this->createRequest(Endpoints\OpenOrders::class, compact(
124
            'symbol'
125
        ));
126
    }
127
128
    /**
129
     * {@inheritdoc}
130
     */
131
    public function tradeHistory($symbol = null)
132
    {
133
        return $this->createRequest(Endpoints\TradeHistory::class, compact(
134
            'symbol'
135
        ));
136
    }
137
}
138