@@ -429,8 +429,8 @@ def get_securities_margin(
429
429
order_book_ids , # type: Union[str, Iterable[str]]
430
430
count = 1 , # type: Optional[int]
431
431
fields = None , # type: Optional[str]
432
- expect_df = False # type: Optional[bool]
433
- ): # type: (...) -> Union[pd.Series, pd.DataFrame, pd.Panel ]
432
+ expect_df = True # type: Optional[bool]
433
+ ): # type: (...) -> Union[pd.Series, pd.DataFrame]
434
434
"""
435
435
获取融资融券信息。包括 `深证融资融券数据 <http://www.szse.cn/main/disclosure/rzrqxx/rzrqjy/>`_ 以及 `上证融资融券数据 <http://www.sse.com.cn/market/othersdata/margin/detail/>`_ 情况。既包括个股数据,也包括市场整体数据。需要注意,融资融券的开始日期为2010年3月31日。
436
436
@@ -524,11 +524,15 @@ def get_securities_margin(
524
524
start_dt = dt
525
525
else :
526
526
start_dt = data_proxy .get_previous_trading_date (dt , count - 1 )
527
-
527
+
528
+ overall_code = {"XSHG" , "XSHE" , "sh" , "sz" }
528
529
if isinstance (order_book_ids , six .string_types ):
529
- order_book_ids = assure_order_book_id (order_book_ids )
530
+ if order_book_ids not in overall_code :
531
+ order_book_ids = assure_order_book_id (order_book_ids )
530
532
else :
531
- order_book_ids = [assure_order_book_id (i ) for i in order_book_ids ]
533
+ overall_code_list = [i for i in order_book_ids if i in overall_code ]
534
+ order_book_ids = [assure_order_book_id (i ) for i in order_book_ids if i not in overall_code ]
535
+ order_book_ids = order_book_ids + overall_code_list
532
536
533
537
return rqdatac .get_securities_margin (order_book_ids , start_dt , dt , fields = fields , expect_df = expect_df )
534
538
0 commit comments