-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get all historical data since 01/01/2000
- Loading branch information
Dale Nguyen
committed
Feb 28, 2021
1 parent
8fc572c
commit 192fea2
Showing
8 changed files
with
42 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
|
||
setup( | ||
name="stockai", | ||
version="1.2.0", | ||
version="1.4.0", | ||
author="Dale Nguyen", | ||
author_email="[email protected]", | ||
description="Get stock info from Yahoo! Finance", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
from time import mktime | ||
from time import mktime, time | ||
from ciso8601 import parse_datetime | ||
from datetime import datetime | ||
|
||
def date_to_timestamp(date): | ||
""" | ||
Convert date to timestamp | ||
""" | ||
Convert date to timestamp | ||
:param date: date string '2019-04-30' | ||
:return: timestamp int 1546318800 | ||
""" | ||
ts = parse_datetime(date) | ||
# to get time in seconds: | ||
return int(mktime(ts.timetuple())) | ||
:param date: date string '2019-04-30' | ||
:return: timestamp int 1546318800 | ||
""" | ||
ts = parse_datetime(date) | ||
# to get time in seconds: | ||
return int(mktime(ts.timetuple())) | ||
|
||
def timestamp_to_date(timestamp): | ||
""" | ||
Convert timestamp to readable date | ||
""" | ||
Convert timestamp to readable date | ||
:param timestamp: timestamp string '1546318800' | ||
:return: date string '2019-04-30' | ||
""" | ||
return datetime.utcfromtimestamp(timestamp).strftime('%Y-%m-%d') | ||
:param timestamp: timestamp string '1546318800' | ||
:return: date string '2019-04-30' | ||
""" | ||
return datetime.utcfromtimestamp(timestamp).strftime('%Y-%m-%d') | ||
|
||
def get_current_timestamp(): | ||
return int(time()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
""" | ||
StockAI v1.2.0 | ||
StockAI | ||
Copyright (c) Dale Nguyen | ||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
""" | ||
StockAI v1.2.0 | ||
StockAI | ||
Copyright (c) Dale Nguyen | ||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters