Skip to content

Commit

Permalink
Bug fixes.
Browse files Browse the repository at this point in the history
Changes to be committed:
	modified:   Extras/AnalyzeAsset
	modified:   Extras/CodeProofs/oandaOpenTrades
	modified:   requirements.txt
  • Loading branch information
rapmd73 committed Nov 28, 2023
1 parent d2e3a94 commit 7baec2a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
14 changes: 7 additions & 7 deletions Extras/AnalyzeAsset
Original file line number Diff line number Diff line change
Expand Up @@ -82,24 +82,24 @@ print(f"Timeframe duration: {y} years, {m} months, {d} days")

print()

print(f"Maximum market high: {round(mh,percision)}")
print(f"Minimum market low: {round(ml,percision)}")
print(f"Highest market spread: {round(sp,percision)}")
print(f"Maximum market high: {round(mh,percision):.{percision}f}")
print(f"Minimum market low: {round(ml,percision):.{percision}f}")
print(f"Highest market spread: {round(sp,percision):.{percision}f}")

print()

mavg=sum(avgList)/len(avgList)

print(f"Market median: {round((mh+ml)/2,percision)}")
print(f"Market average: {round(mavg,percision)}")
print(f"Market median: {round((mh+ml)/2,percision):.{percision}f}")
print(f"Market average: {round(mavg,percision):.{percision}f}")

print()

mmm=maxMonth[2]-maxMonth[3] # Maximum monthly movement
amm=sum(spList)/len(spList) # Average monthly movement

print(f"Maximum month movement: {round(mmm,percision)} ({(mmm/mh)*100:.2f}%)")
print(f"Average month movement: {round(amm,percision)} ({(amm/mh)*100:.2f}%)")
print(f"Maximum month movement: {round(mmm,percision):.{percision}f} ({(mmm/mh)*100:.2f}%)")
print(f"Average month movement: {round(amm,percision):.{percision}f} ({(amm/mh)*100:.2f}%)")

print()

Expand Down
9 changes: 8 additions & 1 deletion Extras/CodeProofs/oandaOpenTrades
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import sys
sys.path.append('/home/GitHub/JackrabbitRelay/Base/Library')
import os
import json
import datetime

import JackrabbitRelay as JRR

Expand All @@ -27,6 +28,12 @@ oo=relay.GetOpenTrades(symbol=asset)

tpnl=0
for o in oo:
# find trade open time
parts=o['openTime'].split('.')
dsS=f"{parts[0]}.{parts[1][:6]}Z"
dt=datetime.datetime.strptime(dsS,'%Y-%m-%dT%H:%M:%S.%fZ')
epoch=dt.timestamp()

iu=int(o['currentUnits'])
price=float(o['price'])
upl=float(o['unrealizedPL'])
Expand All @@ -36,5 +43,5 @@ for o in oo:
side='Long'
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(f"{o['openTime']} {epoch} {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),len(oo))
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ pandas
numpy
ccxt
oandapyV20
aiohttp: 3.8.6 -> 3.9.0

0 comments on commit 7baec2a

Please sign in to comment.