概要
OandaFXの口座残高,有効証拠金を返す.
引数
- OandaのアカウントID(str型)
- api※
※次のように定義:
api= API(access_token=*****, environment=”practiceまたはlive”)
戻り値
- 口座残高(float型)
- 有効証拠金(float型)
コード
import oandapyV20.endpoints.instruments as instruments
#売買用ライブラリインポート
import oandapyV20.endpoints.accounts as accounts #201222 追加
def BalanceCheck_Oanda_ver0(accountID,api):
r = accounts.AccountSummary(accountID)
response = api.request(r)
#print(response)
Balance=float(response["account"]["balance"]) #口座残高
EffectiveMargin=float(response["account"]["marginCloseoutNAV"]) #有効証拠金
return(Balance,EffectiveMargin)
python用ライブラリ”oandapyV20”をインストール,インポートして使う.



コメント