fix trading pair, loading scripts
This commit is contained in:
parent
fb3dc68a1d
commit
28386cdf12
@ -11,6 +11,7 @@ The enhanced `pt_backtest.py` script now supports multi-day and multi-instrument
|
|||||||
- Support for wildcard patterns in configuration files
|
- Support for wildcard patterns in configuration files
|
||||||
- CLI override for data file specification
|
- CLI override for data file specification
|
||||||
|
|
||||||
|
|
||||||
### 2. Dynamic Instrument Selection
|
### 2. Dynamic Instrument Selection
|
||||||
- Auto-detection of instruments from database
|
- Auto-detection of instruments from database
|
||||||
- CLI override for instrument specification
|
- CLI override for instrument specification
|
||||||
|
|||||||
@ -381,11 +381,11 @@ class TradingPair:
|
|||||||
instrument_sign = -1 if instrument_open_trades["action"].iloc[0] == "SELL" else 1
|
instrument_sign = -1 if instrument_open_trades["action"].iloc[0] == "SELL" else 1
|
||||||
instrument_price = predicted_row[f"{self.price_column_}_{symbol}"]
|
instrument_price = predicted_row[f"{self.price_column_}_{symbol}"]
|
||||||
instrument_return = instrument_sign * (instrument_price - instrument_open_trades["price"].iloc[0]) / instrument_open_trades["price"].iloc[0]
|
instrument_return = instrument_sign * (instrument_price - instrument_open_trades["price"].iloc[0]) / instrument_open_trades["price"].iloc[0]
|
||||||
return float(instrument_return)
|
return float(instrument_return) * 100.0
|
||||||
|
|
||||||
instrument_a_return = _single_instrument_return(self.symbol_a_)
|
instrument_a_return = _single_instrument_return(self.symbol_a_)
|
||||||
instrument_b_return = _single_instrument_return(self.symbol_b_)
|
instrument_b_return = _single_instrument_return(self.symbol_b_)
|
||||||
return (instrument_a_return + instrument_b_return) * 100.0
|
return (instrument_a_return + instrument_b_return)
|
||||||
return 0.0
|
return 0.0
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
|
|||||||
@ -16,7 +16,12 @@ cd $(realpath $(dirname $0))/..
|
|||||||
mkdir -p ./data/crypto
|
mkdir -p ./data/crypto
|
||||||
pushd ./data/crypto
|
pushd ./data/crypto
|
||||||
|
|
||||||
Cmd="rsync -ahvv cvtt@hs01.cvtt.vpn:/works/cvtt/md_archive/crypto/sim/*.gz ./"
|
Files=$1
|
||||||
|
if [ -z "$Files" ]; then
|
||||||
|
Files="*.gz"
|
||||||
|
fi
|
||||||
|
|
||||||
|
Cmd="rsync -ahvv cvtt@hs01.cvtt.vpn:/works/cvtt/md_archive/crypto/sim/${Files} ./"
|
||||||
echo $Cmd
|
echo $Cmd
|
||||||
eval $Cmd
|
eval $Cmd
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
|
|||||||
@ -26,8 +26,12 @@ for srcfname in $(ls *.db.gz); do
|
|||||||
tgtfile=${dt}.mktdata.ohlcv.db
|
tgtfile=${dt}.mktdata.ohlcv.db
|
||||||
echo "${srcfname} -> ${tgtfile}"
|
echo "${srcfname} -> ${tgtfile}"
|
||||||
|
|
||||||
gunzip -c $srcfname > temp.db
|
Cmd="gunzip -c $srcfname > temp.db && rm $srcfname"
|
||||||
rm -f ${tgtfile} && sqlite3 temp.db ".dump md_1min_bars" | sqlite3 ${tgtfile} && rm ${srcfname}
|
echo ${Cmd}
|
||||||
|
eval ${Cmd}
|
||||||
|
Cmd="rm -f ${tgtfile} && sqlite3 temp.db '.dump md_1min_bars' | sqlite3 ${tgtfile}"
|
||||||
|
echo ${Cmd}
|
||||||
|
eval ${Cmd}
|
||||||
done
|
done
|
||||||
rm temp.db
|
rm temp.db
|
||||||
popd
|
popd
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user