我正在尝试配置Google Cloud Functions以在触发该功能时下订单。
我在kiteconnect
文件中提到了requirements.txt
但是该功能未部署。引发错误“未知资源类型”。
完整错误消息:
Deployment failure: Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT","errorMessage": "`pip_download_wheels` had stderr output:\nCommand \"python setup.py egg_info\" failed with error code 1 in /tmp/pip-wheel-97dghcl9/logging/\n\nerror: `pip_download_wheels` returned code: 1","errorType": "InternalError","errorId": "67DBDBF3"}}
有人有处理云功能以在Zerodah下达交易订单的经验吗?
以下是我尝试过的功能:
import logging
from kiteconnect import KiteConnect
logging.basicConfig(level=logging.DEBUG)
kite = KiteConnect(api_key="xxxxxxxxxxxxxxxxxxxxxxxx")
# Redirect the user to the login url obtained
# from kite.login_url(),and receive the request_token
# from the registered redirect url after the login flow.
# Once you have the request_token,obtain the access_token
# as follows.
data = kite.generate_session("xxxxxxxxxxxxxxxxxxxxxxxxx",secret="xxxxxxxxxxxxxxxxxxxxxxxxxx")
kite.set_access_token(data["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"])
# Place an order
def orderPlace():
order_id = kite.place_order(
variety=kite.VARIETY_REGULAR,exchange=kite.EXCHANGE_NSE,tradingsymbol="INFY",transaction_type=kite.TRANSactION_TYPE_BUY,quantity=1,product=kite.PRODUCT_CNC,order_type=kite.ORDER_TYPE_MARKET
)
logging.info("Order placed. ID is: {}".format(order_id))
except Exception as e:
logging.info("Order placement failed: {}".format(e.message))
Requirements.txt文件的内容:
# Function dependencies,for example:
# package>=version
kiteconnect