FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
openapi/python/src/quote/push.rs at main · noneback/openapi · GitHub
noneback
/
openapi
Public
forked from
longbridge/openapi
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
openapi
/
python
/
src
/
quote
/
push.rs
Copy path
More file actions
More file actions
Latest commit
History
History
History
81 lines (74 loc) · 2.55 KB
Breadcrumbs
openapi
/
python
/
src
/
quote
/
push.rs
Copy path
File metadata and controls
81 lines (74 loc) · 2.55 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
use
longport
::
quote
::
{
PushBrokers
,
PushCandlestick
,
PushDepth
,
PushEvent
,
PushEventDetail
,
PushQuote
,
PushTrades
,
}
;
use
pyo3
::
prelude
::
*
;
use
crate
::
quote
::
context
::
Callbacks
;
pub
(
crate
)
fn
handle_push_event
(
callbacks
:
&
Callbacks
,
event
:
PushEvent
)
{
match
event
.
detail
{
PushEventDetail
::
Quote
(
quote
)
=>
handle_quote
(
callbacks
,
event
.
symbol
,
quote
)
,
PushEventDetail
::
Depth
(
depth
)
=>
handle_depth
(
callbacks
,
event
.
symbol
,
depth
)
,
PushEventDetail
::
Brokers
(
brokers
)
=>
handle_brokers
(
callbacks
,
event
.
symbol
,
brokers
)
,
PushEventDetail
::
Trade
(
trades
)
=>
handle_trades
(
callbacks
,
event
.
symbol
,
trades
)
,
PushEventDetail
::
Candlestick
(
candlestick
)
=>
{
handle_candlesticks
(
callbacks
,
event
.
symbol
,
candlestick
)
}
}
}
fn
handle_quote
(
callbacks
:
&
Callbacks
,
symbol
:
String
,
quote
:
PushQuote
)
{
if
let
Some
(
callback
)
=
&
callbacks
.
quote
{
let
_ =
Python
::
with_gil
(
|py|
{
callback
.
call
(
py
,
(
symbol
,
crate
::
quote
::
types
::
PushQuote
::
try_from
(
quote
)
?
)
,
None
,
)
}
)
;
}
}
fn
handle_depth
(
callbacks
:
&
Callbacks
,
symbol
:
String
,
depth
:
PushDepth
)
{
if
let
Some
(
callback
)
=
&
callbacks
.
depth
{
let
_ =
Python
::
with_gil
(
|py|
{
callback
.
call
(
py
,
(
symbol
,
crate
::
quote
::
types
::
PushDepth
::
try_from
(
depth
)
?
)
,
None
,
)
}
)
;
}
}
fn
handle_brokers
(
callbacks
:
&
Callbacks
,
symbol
:
String
,
brokers
:
PushBrokers
)
{
if
let
Some
(
callback
)
=
&
callbacks
.
brokers
{
let
_ =
Python
::
with_gil
(
|py|
{
callback
.
call
(
py
,
(
symbol
,
crate
::
quote
::
types
::
PushBrokers
::
try_from
(
brokers
)
?
)
,
None
,
)
}
)
;
}
}
fn
handle_trades
(
callbacks
:
&
Callbacks
,
symbol
:
String
,
trades
:
PushTrades
)
{
if
let
Some
(
callback
)
=
&
callbacks
.
trades
{
let
_ =
Python
::
with_gil
(
|py|
{
callback
.
call
(
py
,
(
symbol
,
crate
::
quote
::
types
::
PushTrades
::
try_from
(
trades
)
?
)
,
None
,
)
}
)
;
}
}
fn
handle_candlesticks
(
callbacks
:
&
Callbacks
,
symbol
:
String
,
candlestick
:
PushCandlestick
)
{
if
let
Some
(
callback
)
=
&
callbacks
.
candlestick
{
let
_ =
Python
::
with_gil
(
|py|
{
callback
.
call
(
py
,
(
symbol
,
crate
::
quote
::
types
::
PushCandlestick
::
try_from
(
candlestick
)
?
,
)
,
None
,
)
}
)
;
}
}
Back
|
FazBrowse Home
|
New Git URL