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
83e6f774
Commit
83e6f774
authored
Sep 10, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/ticker' into 'master'
bitnasdaq See merge request
!382
parents
88659d4a
59f05ea0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
20 deletions
+14
-20
Bitnasdaq.php
common/service/exchange/Bitnasdaq.php
+14
-20
No files found.
common/service/exchange/Bitnasdaq.php
View file @
83e6f774
...
...
@@ -15,7 +15,7 @@ class Bitnasdaq extends Exchange implements ExchangeInterface
{
protected
$supported_symbol
=
'supported_symbol_bitnasdaq'
;
protected
$quotation_prefix
=
'quotation_bitnasdaq_'
;
protected
$base_url
=
'https://
www.bitnasdaq.com
/'
;
protected
$base_url
=
'https://
openapi.bitnasdaq.pro
/'
;
public
function
formatSymbol
(
$tag
=
'BTC'
,
$aim
=
'USDT'
)
{
...
...
@@ -24,35 +24,29 @@ class Bitnasdaq extends Exchange implements ExchangeInterface
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
'
;
$api
=
$this
->
base_url
.
'/
open/api/get_allticker
'
;
$res
=
$curl
->
get
(
$api
,
false
);
if
(
is_array
(
$res
)
&&
isset
(
$res
[
'obj'
]))
{
$data
=
$res
[
'obj'
];
if
(
is_array
(
$res
)
&&
isset
(
$res
[
'data'
]))
{
$data
=
$res
[
'data'
][
'ticker'
];
foreach
(
$data
as
$key
=>
$item
)
{
if
(
strpos
(
strtoupper
(
$key
),
'_CNYT'
)
!==
false
)
{
if
(
strpos
(
strtoupper
(
$key
),
'_CNYT'
)
!==
false
)
{
continue
;
}
$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
)
);
$low
=
isset
(
$item
[
'
low'
])
?
$item
[
'low
'
]
:
0
;
$high
=
isset
(
$item
[
'
high'
])
?
$item
[
'high
'
]
:
0
;
$last
=
isset
(
$item
[
'
last'
])
?
$item
[
'last
'
]
:
0
;
$open
=
isset
(
$item
[
'
last'
])
?
$item
[
'last
'
]
:
0
;
$vol
=
isset
(
$item
[
'
vol'
])
?
$item
[
'vol
'
]
:
0
;
$cache_key
=
strtolower
(
$this
->
quotation_prefix
.
$item
[
'symbol'
]
);
$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
)
));
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
strtoupper
(
$item
[
'symbol'
]
));
}
}
}
...
...
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