diff --git a/Base/Library/JRRoanda.py b/Base/Library/JRRoanda.py index 4e9ab56..d135bf5 100644 --- a/Base/Library/JRRoanda.py +++ b/Base/Library/JRRoanda.py @@ -276,10 +276,11 @@ def GetOpenOrders(self,**kwargs): # As references in GetPosition, a position may consist of one or more actual # trades. This is NOT the same as an open list of limit orders. + # count is maximum number o allowed open trades. def GetOpenTrades(self,**kwargs): symbol=kwargs.get('symbol').replace('/','_') - params={"instrument":symbol } + params={"instrument":symbol,"count":500 } self.SetPipValue(symbol) req=v20Trades.TradesList(accountID=self.AccountID,params=params) diff --git a/Extras/CodeProofs/oandaOpenTrades b/Extras/CodeProofs/oandaOpenTrades index 1abe8c1..accb216 100755 --- a/Extras/CodeProofs/oandaOpenTrades +++ b/Extras/CodeProofs/oandaOpenTrades @@ -37,4 +37,4 @@ for o in oo: else: side='Shrt' print(f"{o['openTime']} {o['instrument']:10} {o['id']:7} {side:4} {iu:16.5f} {price:16.5f} {upl:16.5f} {fin:16.5f}") -print("\n",round(tpnl,5)) +print("\n",round(tpnl,5),len(oo)) diff --git a/Extras/CodeProofs/place100orders b/Extras/CodeProofs/place100orders new file mode 100755 index 0000000..8e58e4d --- /dev/null +++ b/Extras/CodeProofs/place100orders @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Jackrabbit Relay +# 2021 Copyright © Robert APM Darin +# All rights reserved unconditionally. + +import sys +sys.path.append('/home/GitHub/JackrabbitRelay/Base/Library') +import os +import json + +import JackrabbitRelay as JRR + +### +### Main code base. Place order on exchange +### + +relay=JRR.JackrabbitRelay() +if relay.GetArgsLen() > 4: + exchangeName=relay.GetExchange() + account=relay.GetAccount() + asset=relay.GetAsset() + side=relay.GetArgs(4) + amount=relay.GetArgs(5) +else: + print("An exchange, (sub)account, an asset, a side (buy/sell), and an amount must be provided.") + sys.exit(1) + +u=float(amount) +for i in range(100): + ticker=relay.GetTicker(symbol=asset) + bPrice=ticker['Ask'] + sPrice=ticker['Bid'] + + mPrice=min(bPrice,sPrice) + + result=relay.PlaceOrder(pair=asset,orderType="market",action=side,amount=u,price=bPrice) + print(result) + u+=1 diff --git a/Extras/CodeProofs/readMarkets b/Extras/CodeProofs/readMarkets index 86c8b4f..9fe1145 100755 --- a/Extras/CodeProofs/readMarkets +++ b/Extras/CodeProofs/readMarkets @@ -23,6 +23,8 @@ else: print("An exchange and a (sub)account must be provided.") sys.exit(1) +print(relay.Broker.Summary) + # Already loaded from login markets=relay.Markets