مشکل در دریافت داده های اختیار معامله
noktebin opened this issue · 1 comments
امروز در متد tse_options_mw بعضی سطرهای دادهای که از بورس برمیگشت تقریبا همه فیلدهاش None و خالی و empty بود
ما برای رفع سریع مشکل این کارو کردیم. حالا خودتون هر طور بهتر میدونید کتابخانه رو اصلاح کنید.
def tse_options_mw(self):
r = self.requests(self.url.tse_options_mw())
insOptMarkWatch = []
for i in range(len(r[0]["instrumentOptMarketWatch"])):
try:
OptionsMW(**r[0]["instrumentOptMarketWatch"][i]).model_dump()
insOptMarkWatch.append(r[0]["instrumentOptMarketWatch"][i])
except ValidationError:
pass
df = pl.from_dicts(
[OptionsMW(**i).model_dump() for i in insOptMarkWatch]
)
return df
def ifb_options_mw(self):
r = self.requests(self.url.ifb_options_mw())
insOptMarkWatch = []
for i in range(len(r[0]["instrumentOptMarketWatch"])):
try:
OptionsMW(**r[0]["instrumentOptMarketWatch"][i]).model_dump()
insOptMarkWatch.append(r[0]["instrumentOptMarketWatch"][i])
except ValidationError:
pass
df = pl.from_dicts(
[OptionsMW(**i).model_dump() for i in insOptMarkWatch]
)
return df
نمونه بخشی از داده های خراب بورس
{"insCode_P":null,"insCode_C":"8355388770315324","contractSize":0,"uaInsCode":null,"lVal18AFC_P":null,"lVal30_P":null,"zTotTran_P":0,"qTotTran5J_P":0,"qTotCap_P":0.0,"notionalValue_P":0.0,"pClosing_P":0,"priceYesterday_P":0,"oP_P":0,"pDrCotVal_P":0,"lval30_UA":null,"pClosing_UA":0,"priceYesterday_UA":0,"beginDate":null,"endDate":null,"strikePrice":0,"remainedDay":0,"pDrCotVal_C":1,"oP_C":0,"pClosing_C":1,"priceYesterday_C":1,"notionalValue_C":0.0,"qTotCap_C":0.00,"qTotTran5J_C":0,"zTotTran_C":0,"lVal30_C":"اختيارف شستا-700-1403/06/11","lVal18AFC_C":"طستا6015","pMeDem_P":0,"qTitMeDem_P":0,"pMeOf_P":0,"qTitMeOf_P":0,"pMeDem_C":0,"qTitMeDem_C":0,"pMeOf_C":0,"qTitMeOf_C":0,"yesterdayOP_C":0,"yesterdayOP_P":0},{"insCode_P":null,"insCode_C":"17916144169578248","contractSize":0,"uaInsCode":null,"lVal18AFC_P":null,"lVal30_P":null,"zTotTran_P":0,"qTotTran5J_P":0,"qTotCap_P":0.0,"notionalValue_P":0.0,"pClosing_P":0,"priceYesterday_P":0,"oP_P":0,"pDrCotVal_P":0,"lval30_UA":null,"pClosing_UA":0,"priceYesterday_UA":0,"beginDate":null,"endDate":null,"strikePrice":0,"remainedDay":0,"pDrCotVal_C":509,"oP_C":100,"pClosing_C":509,"priceYesterday_C":1,"notionalValue_C":112100000.00,"qTotCap_C":50900000.00,"qTotTran5J_C":100,"zTotTran_C":5,"lVal30_C":"اختيارخ شستا-700-1403/06/11","lVal18AFC_C":"ضستا6015","pMeDem_P":0,"qTitMeDem_P":0,"pMeOf_P":0,"qTitMeOf_P":0,"pMeDem_C":429,"qTitMeDem_C":11,"pMeOf_C":545,"qTitMeOf_C":130,"yesterdayOP_C":0,"yesterdayOP_P":0},{"insCode_P":null,"insCode_C":"22895562605633961","contractSize":0,"uaInsCode":null,"lVal18AFC_P":null,"lVal30_P":null,"zTotTran_P":0,"qTotTran5J_P":0,"qTotCap_P":0.0,"notionalValue_P":0.0,"pClosing_P":0,"priceYesterday_P":0,"oP_P":0,"pDrCotVal_P":0,"lval30_UA":null,"pClosing_UA":0,"priceYesterday_UA":0,"beginDate":null,"endDate":null,"strikePrice":0,"remainedDay":0,"pDrCotVal_C":1,"oP_C":0,"pClosing_C":1,"priceYesterday_C":1,"notionalValue_C":0.0,"qTotCap_C":0.00,"qTotTran5J_C":0,"zTotTran_C":0,"lVal30_C":"اختيارف شستا-1300-1403/06/11","lVal18AFC_C":"طستا6021","pMeDem_P":0,"qTitMeDem_P":0,"pMeOf_P":0,"qTitMeOf_P":0,"pMeDem_C":0,"qTitMeDem_C":0,"pMeOf_C":0,"qTitMeOf_C":0,"yesterdayOP_C":0,"yesterdayOP_P":0},{"insCode_P":null,"insCode_C":"6624489450717588","contractSize":0,"uaInsCode":null,"lVal18AFC_P":null,"lVal30_P":null,"zTotTran_P":0,"qTotTran5J_P":0,"qTotCap_P":0.0,"notionalValue_P":0.0,"pClosing_P":0,"priceYesterday_P":0,"oP_P":0,"pDrCotVal_P":0,"lval30_UA":null,"pClosing_UA":0,"priceYesterday_UA":0,"beginDate":null,"endDate":null,"strikePrice":0,"remainedDay":0,"pDrCotVal_C":60,"oP_C":5,"pClosing_C":60,"priceYesterday_C":1,"notionalValue_C":5600000.00,"qTotCap_C":300000.00,"qTotTran5J_C":5,"zTotTran_C":1,"lVal30_C":"اختيارخ شستا-1300-1403/06/11","lVal18AFC_C":"ضستا6021","pMeDem_P":0,"qTitMeDem_P":0,"pMeOf_P":0,"qTitMeOf_P":0,"pMeDem_C":50,"qTitMeDem_C":100,"pMeOf_C":199,"qTitMeOf_C":50,"yesterdayOP_C":0,"yesterdayOP_P":0},