Skip to content

Commit 8fc1fa4

Browse files
committed
modify change log
1 parent 8f5ad43 commit 8fc1fa4

File tree

3 files changed

+34
-27
lines changed

3 files changed

+34
-27
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
attr_desc:属性描述(如期权是否为被动行权)
99
source:订单来源
1010

11+
### Breaking
12+
-`tigeropen.quote.request.OpenApiRequest` 移动到 `tigeropen.common.request.OpenApiRequest`
13+
14+
1115
## 2.0.5 (2022-01-10)
1216
### New
1317
- 查询行情权限接口 QuoteClient.get_quote_permission

tigeropen/examples/trade_client_demo.py

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99

1010
from tigeropen.trade.domain.order import OrderStatus
1111
from tigeropen.trade.request.model import AccountsParams
12-
from tigeropen.common.response import TigerResponse
1312
from tigeropen.tiger_open_client import TigerOpenClient
1413
from tigeropen.trade.trade_client import TradeClient
14+
from tigeropen.common.response import TigerResponse
1515
from tigeropen.common.request import OpenApiRequest
16-
from tigeropen.examples.client_config import get_client_config
1716
from tigeropen.common.consts import Currency, SecurityType
1817
from tigeropen.common.util.contract_utils import stock_contract, option_contract_by_symbol, future_contract, \
1918
war_contract_by_symbol, iopt_contract_by_symbol
2019
from tigeropen.common.util.order_utils import limit_order, limit_order_with_legs, order_leg, algo_order_params, \
2120
algo_order
21+
from tigeropen.examples.client_config import get_client_config
2222

2323
logging.basicConfig(level=logging.INFO,
2424
format='%(asctime)s %(levelname)s %(message)s',
@@ -28,29 +28,6 @@
2828
client_config = get_client_config()
2929

3030

31-
def get_account_info():
32-
from tigeropen.common.consts.service_types import ACCOUNTS
33-
openapi_client = TigerOpenClient(client_config)
34-
account = AccountsParams()
35-
account.account = client_config.account
36-
request = OpenApiRequest(method=ACCOUNTS, biz_model=account)
37-
38-
response_content = None
39-
try:
40-
response_content = openapi_client.execute(request)
41-
except Exception as e:
42-
print(traceback.format_exc())
43-
if not response_content:
44-
print("failed to execute")
45-
else:
46-
response = TigerResponse()
47-
response.parse_response_content(response_content)
48-
if response.is_success():
49-
print("get response data:" + response.data)
50-
else:
51-
print("%d,%s,%s" % (response.code, response.message, response.data))
52-
53-
5431
def get_account_apis():
5532
openapi_client = TradeClient(client_config, logger=logger)
5633
openapi_client.get_managed_accounts()
@@ -144,7 +121,33 @@ def algo_order_demo():
144121
print(order)
145122

146123

124+
def get_account_info():
125+
"""
126+
request by build OpenApiRequest. Not recommend.
127+
:return:
128+
"""
129+
from tigeropen.common.consts.service_types import ACCOUNTS
130+
openapi_client = TigerOpenClient(client_config)
131+
account = AccountsParams()
132+
account.account = client_config.account
133+
request = OpenApiRequest(method=ACCOUNTS, biz_model=account)
134+
135+
response_content = None
136+
try:
137+
response_content = openapi_client.execute(request)
138+
except Exception as e:
139+
print(traceback.format_exc())
140+
if not response_content:
141+
print("failed to execute")
142+
else:
143+
response = TigerResponse()
144+
response.parse_response_content(response_content)
145+
if response.is_success():
146+
print("get response data:" + response.data)
147+
else:
148+
print("%d,%s,%s" % (response.code, response.message, response.data))
149+
150+
147151
if __name__ == '__main__':
148-
get_account_info()
149152
get_account_apis()
150153
trade_apis()

tigeropen/quote/quote_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
FUTURE_CURRENT_CONTRACT, QUOTE_REAL_TIME, QUOTE_STOCK_TRADE, FINANCIAL_DAILY, FINANCIAL_REPORT, CORPORATE_ACTION, \
2020
QUOTE_DEPTH, INDUSTRY_LIST, INDUSTRY_STOCKS, STOCK_INDUSTRY, STOCK_DETAIL
2121
from tigeropen.common.exceptions import ApiException
22+
from tigeropen.common.request import OpenApiRequest
2223
from tigeropen.common.util.common_utils import eastern, get_enum_value
2324
from tigeropen.common.util.contract_utils import extract_option_info
2425
from tigeropen.fundamental.request.model import FinancialDailyParams, FinancialReportParams, CorporateActionParams, \
@@ -31,7 +32,6 @@
3132
from tigeropen.fundamental.response.industry_response import IndustryListResponse, IndustryStocksResponse, \
3233
StockIndustryResponse
3334
from tigeropen.quote.domain.filter import OptionFilter
34-
from tigeropen.common.request import OpenApiRequest
3535
from tigeropen.quote.request.model import MarketParams, MultipleQuoteParams, MultipleContractParams, \
3636
FutureQuoteParams, FutureExchangeParams, FutureTypeParams, FutureTradingTimeParams, SingleContractParams, \
3737
SingleOptionQuoteParams, DepthQuoteParams, OptionChainParams

0 commit comments

Comments
 (0)