FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Finance-Python/examples/example_101.py at master · alpha-miner/Finance-Python · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
alpha-miner
/
Finance-Python
Public
Notifications
You must be signed in to change notification settings
Fork
148
Star
911
Code
Issues
9
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Finance-Python
/
examples
/
example_101.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (24 loc) · 712 Bytes
Breadcrumbs
Finance-Python
/
examples
/
example_101.py
Copy path
File metadata and controls
31 lines (24 loc) · 712 Bytes
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
# -*- coding: utf-8 -*-
u"""
Created on 2016-12-25
@author: cheng.li
"""
import
datetime
as
dt
import
pandas
as
pd
sample_data
=
pd
.
DataFrame
(
data
=
{
'code'
: [
1
,
2
,
1
,
2
,
1
,
2
],
'open'
: [
2.0
,
1.0
,
1.5
,
3.0
,
2.4
,
3.5
],
'close'
: [
1.7
,
1.6
,
0.9
,
3.8
,
1.6
,
2.1
]},
index
=
[
dt
.
datetime
(
2016
,
1
,
1
),
dt
.
datetime
(
2016
,
1
,
1
),
dt
.
datetime
(
2016
,
1
,
2
),
dt
.
datetime
(
2016
,
1
,
2
),
dt
.
datetime
(
2016
,
1
,
3
),
dt
.
datetime
(
2016
,
1
,
3
)]
)
sample_data
=
sample_data
[[
'code'
,
'open'
,
'close'
]]
if
__name__
==
'__main__'
:
from
PyFin
.
api
import
MA
ts
=
MA
(
2
,
'close'
)
res
=
ts
.
transform
(
sample_data
,
name
=
'ma_2_no_code'
)
print
(
res
)
Back
|
FazBrowse Home
|
New Git URL