Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug44 #63

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Fix bug44 #63

wants to merge 6 commits into from

Conversation

machineCYC
Copy link

我嘗試解這個問題, 不確定是不是這樣做

  1. 修正 twstock/analytics.py 裡面的 moving_average function,支援 skipna 的功能
  2. 在 test/test_analytics.py 加上相關的 test case 但 legacy.moving_average 不確定是否也要新增 skipna功能
  3. 在 docs 裡面加上相對應的 document

def moving_average(self, data, days, skipna=True):
if skipna:
data = [x for x in data if x is not None]

result = []
data = data[:]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這行可以移到上面那個 if 之後的 else,避免多複製一次 data

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯嗯! 我修改過了! 謝謝

@machineCYC
Copy link
Author

@mlouielu hi, 我發現這個沒過的部分是太頻繁的對原始資料網站做 request,導致無法連上,已經不是跟這個議題的程式有關。請問該怎麼解決才能完成這個MR呢?

@hourtest
Copy link

hourtest commented Nov 27, 2019

請問這個連線有限制嗎 我要抓全部股票31天內的資訊

抓到中間某之就錯誤 還是其他問題

ConnectionError: ('Connection aborted.', ConnectionResetError(10054, '遠端主機已強制關閉一個現存的連線。', None, 10054, None))

@machineCYC
Copy link
Author

@hourtest 這個好像 request 太頻繁會被 ban ip
你可以考慮使用 finmind 提供的 api

@mlouielu
Copy link
Owner

mlouielu commented Nov 27, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants