Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
token
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wallet
token
Commits
ed4fabd6
Commit
ed4fabd6
authored
Nov 14, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
116cff99
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
4 deletions
+63
-4
ExchangeBusiness.php
common/business/ExchangeBusiness.php
+3
-1
Bitnasdaq.php
common/service/exchange/Bitnasdaq.php
+57
-0
BinanceBuilder.php
common/service/exchange/factory/BinanceBuilder.php
+1
-1
HuobiBuilder.php
common/service/exchange/factory/HuobiBuilder.php
+1
-1
ZhaobiBuilder.php
common/service/exchange/factory/ZhaobiBuilder.php
+1
-1
No files found.
common/business/ExchangeBusiness.php
View file @
ed4fabd6
...
@@ -45,7 +45,9 @@ class ExchangeBusiness
...
@@ -45,7 +45,9 @@ class ExchangeBusiness
16
=>
'Ceohk'
,
16
=>
'Ceohk'
,
17
=>
'Biki'
,
17
=>
'Biki'
,
18
=>
'Bilaxy'
,
18
=>
'Bilaxy'
,
19
=>
'Boc'
19
=>
'Bitnasdaq'
,
20
=>
'Boc'
];
];
/**
/**
...
...
common/service/exchange/Bitnasdaq.php
0 → 100644
View file @
ed4fabd6
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-26
* Time: 下午7:21
*/
namespace
common\service\exchange
;
use
Yii
;
use
linslin\yii2\curl\Curl
;
class
Bitnasdaq
extends
Exchange
implements
ExchangeInterface
{
protected
$supported_symbol
=
'supported_symbol_bitnasdaq'
;
protected
$quotation_prefix
=
'quotation_bitnasdaq_'
;
protected
$base_url
=
'https://www.bitnasdaq.com/'
;
public
function
formatSymbol
(
$tag
=
'BTC'
,
$aim
=
'USDT'
)
{
return
strtolower
(
trim
(
$tag
)
.
trim
(
$aim
));
}
public
function
setSupportedSymbol
()
{
$curl
=
new
Curl
();
$api
=
$this
->
base_url
.
'/api/v1/ticker/24hr'
;
$res
=
$curl
->
get
(
$api
,
false
);
//json
if
(
is_array
(
$res
))
{
foreach
(
$res
as
$item
)
{
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
strtolower
(
$item
[
'symbol'
]));
}
}
}
public
function
setQuotation
()
{
$curl
=
new
Curl
();
$api
=
$this
->
base_url
.
'/app/tradeMarket/coinPrice'
;
$res
=
$curl
->
get
(
$api
,
false
);
if
(
is_array
(
$res
)
&&
isset
(
$res
[
'obj'
]))
{
$data
=
$res
[
'obj'
];
foreach
(
$data
as
$key
=>
$item
)
{
$low
=
isset
(
$item
[
'minPrice'
])
?
$item
[
'minPrice'
]
:
0
;
$high
=
isset
(
$item
[
'maxPrice'
])
?
$item
[
'maxPrice'
]
:
0
;
$last
=
isset
(
$item
[
'currentExchangPrice'
])
?
$item
[
'currentExchangPrice'
]
:
0
;
$open
=
isset
(
$item
[
'openPrice'
])
?
$item
[
'openPrice'
]
:
0
;
$vol
=
isset
(
$item
[
'transactionSum'
])
?
$item
[
'transactionSum'
]
:
0
;
$cache_key
=
strtolower
(
$this
->
quotation_prefix
.
str_replace
(
'_'
,
''
,
$key
));
$this
->
redis
->
hmset
(
$cache_key
,
'low'
,
$low
,
'high'
,
$high
,
'last'
,
$last
,
'open'
,
$open
,
'vol'
,
$vol
);
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
strtoupper
(
str_replace
(
'_'
,
''
,
$key
)));
}
}
}
}
common/service/exchange/factory/BinanceBuilder.php
View file @
ed4fabd6
...
@@ -124,7 +124,7 @@ class BinanceBuilder extends FactoryService
...
@@ -124,7 +124,7 @@ class BinanceBuilder extends FactoryService
$this
->
redis_ticker
->
hmset
(
$key
,
'low'
,
$low
,
'high'
,
$high
,
'last'
,
$close
,
'open'
,
$open
,
'vol'
,
$vol
);
$this
->
redis_ticker
->
hmset
(
$key
,
'low'
,
$low
,
'high'
,
$high
,
'last'
,
$close
,
'open'
,
$open
,
'vol'
,
$vol
);
}
}
$ticker_sort_close
=
Tools
::
arraySort
(
$ticker
,
'close'
);
$ticker_sort_close
=
Tools
::
arraySort
(
$ticker
,
'close
_rmb
'
);
$this
->
redis_ticker
->
del
(
$this
->
supported_symbol_close_asc
);
$this
->
redis_ticker
->
del
(
$this
->
supported_symbol_close_asc
);
$this
->
redis_ticker
->
del
(
$this
->
supported_symbol_close_desc
);
$this
->
redis_ticker
->
del
(
$this
->
supported_symbol_close_desc
);
foreach
(
$ticker_sort_close
as
$val
)
{
foreach
(
$ticker_sort_close
as
$val
)
{
...
...
common/service/exchange/factory/HuobiBuilder.php
View file @
ed4fabd6
...
@@ -145,7 +145,7 @@ class HuobiBuilder extends FactoryService
...
@@ -145,7 +145,7 @@ class HuobiBuilder extends FactoryService
$this
->
redis_ticker
->
hmset
(
$key
,
'low'
,
$low
,
'high'
,
$high
,
'last'
,
$close
,
'open'
,
$open
,
'vol'
,
$vol
);
$this
->
redis_ticker
->
hmset
(
$key
,
'low'
,
$low
,
'high'
,
$high
,
'last'
,
$close
,
'open'
,
$open
,
'vol'
,
$vol
);
}
}
$ticker_sort_close
=
Tools
::
arraySort
(
$ticker
,
'close'
);
$ticker_sort_close
=
Tools
::
arraySort
(
$ticker
,
'close
_rmb
'
);
$this
->
redis_ticker
->
del
(
$this
->
supported_symbol_close_asc
);
$this
->
redis_ticker
->
del
(
$this
->
supported_symbol_close_asc
);
$this
->
redis_ticker
->
del
(
$this
->
supported_symbol_close_desc
);
$this
->
redis_ticker
->
del
(
$this
->
supported_symbol_close_desc
);
foreach
(
$ticker_sort_close
as
$val
)
{
foreach
(
$ticker_sort_close
as
$val
)
{
...
...
common/service/exchange/factory/ZhaobiBuilder.php
View file @
ed4fabd6
...
@@ -109,7 +109,7 @@ class ZhaobiBuilder extends FactoryService
...
@@ -109,7 +109,7 @@ class ZhaobiBuilder extends FactoryService
$this
->
redis_ticker
->
hmset
(
$key
,
'low'
,
$low
,
'high'
,
$high
,
'last'
,
$close
,
'open'
,
$open
,
'vol'
,
$vol
);
$this
->
redis_ticker
->
hmset
(
$key
,
'low'
,
$low
,
'high'
,
$high
,
'last'
,
$close
,
'open'
,
$open
,
'vol'
,
$vol
);
}
}
$ticker_sort_close
=
Tools
::
arraySort
(
$ticker
,
'close'
);
$ticker_sort_close
=
Tools
::
arraySort
(
$ticker
,
'close
_rmb
'
);
$this
->
redis_ticker
->
del
(
$this
->
supported_symbol_close_asc
);
$this
->
redis_ticker
->
del
(
$this
->
supported_symbol_close_asc
);
$this
->
redis_ticker
->
del
(
$this
->
supported_symbol_close_desc
);
$this
->
redis_ticker
->
del
(
$this
->
supported_symbol_close_desc
);
foreach
(
$ticker_sort_close
as
$val
)
{
foreach
(
$ticker_sort_close
as
$val
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment