Author Archives: Bryan D

About Bryan D

I am part of a company called QuantLabs.Net This is specifically a company with a high profile blog about technology, trading, financial, investment, quant, etc. It posts things on how to do job interviews with large companies like Morgan Stanley, Bloomberg, Citibank, and IBM. It also posts different unique tips and tricks on Java, C++, or C programming. It posts about different techniques in learning about Matlab and building models or strategies. There is a lot here if you are into venturing into the financial world like quant or technical analysis. It also discusses the future generation of trading and programming Specialties:C++, Java, C#, quant, models, strategies, technical analysis, linux, windows

Crypto coin call for Oct 20

Some coins to take note with   
Symbol       Pct        Close   First Trend    Last Trend         Diff

0 LINKUSDT -0.027738 10.85860 9.533217 10.565537 1.032321
1 BTCUSDT -0.099450 12691.10000 10428.999613 11543.132458 1114.132845
2 XRPUSDT -0.011674 0.25147 0.240275 0.248568 0.008293
3 WAVESUSDT -0.119135 3.08440 2.267114 2.756056 0.488943
4 ETHUSDT -0.057609 391.39000 353.803343 370.070728 16.267385
5 LTCUSDT -0.078789 52.46000 45.514420 48.628603 3.114183
6 XLMUSDT -0.085205 0.08482 0.072490 0.078160 0.005671
7 BCHUSDT -0.037295 257.83000 215.322501 248.559951 33.237450

Demo of save trade history and calculating daily PnL with Python script

Here is a code review and demo how this Python script can help with daily PNL. Also, this appears to be a bug which should be fixed in Motivewave soon.

Here is the code:

import pandas as pd
import glob

fn = glob.glob('C:\\Users\\Bryan\\Dropbox\\Apps\\Blighty Explorer\\TradeHistory *.csv')

df = pd.read_csv(fn[-1])
print('opening '+str(fn[-1]))

## round to 8 decimal places in python pandas 

pd.options.display.float_format = '{:.8f}'.format

cols =['Account','Ticket','Order ID','Symbol','Time','Action','Quantity','Price','P/L','Commission']
df['P/L'] = df['P/L'].fillna(0.0)
df['Price'] = pd.to_numeric(df['Price'],errors='coerce')
df['P/L'] = pd.to_numeric(df['P/L'],errors='coerce')
df['PctRet'] = df['P/L'].values/df['Price'].values 
df['Date'] = pd.to_datetime(df['Time'])
df['Time'] = pd.to_datetime(df['Time']).dt.time

df['PctRet'] = pd.to_numeric(df['PctRet'],errors='coerce')

arrByDay = df.groupby('Date')['PctRet'].sum()
dfCond=df.groupby('Date')['PctRet'].apply(lambda x: (x>0.0).sum()).reset_index(name='count')
totArr = df.groupby('Date')['PctRet'].count()
dfCond['total'] = totArr.values
dfCond['percentChg'] = arrByDay.values
dfCond['winRatio'] = dfCond['count']/dfCond['total']

Ensure proper MotiveWave crypto order preset for minimum quantity size

I show the scenario how to fix any blank/empty P/L from positions and trade history. I cover this solution in this video

I also have a Python source code script for a way to show you the minimum account size needed for each USDT (Tether) order. I would recommend doing this for new strategies/studies/alerts you want to test for trading. You don’t want to take big orders losses during the debugging phase.

Here is some demo examples how to resolve this blanks P/L problem. This may get fixed in a future version of MotiveWave

import pandas as pd
import os 
from csv import reader

    print('minQty.csv does not exist')
with open('usdt.txt') as f: #usdtcoins2.txt usdtallcoins.txt
    datafile = f.readlines()

for line in datafile:
    sym = line.rstrip()
    if sym.find('UP')>0 or sym.find('DOWN')>0 or sym.find('BEAR')>0 or sym.find('BULL')>0:

    symb = sym.replace('/','')
    os.system('python3 -e binance -s '+sym+' -t 1m')
    fn = 'data/binance-'+symb+'-1m.csv'
    df = pd.read_csv(fn, names=['Timestamp', 'Open', 'High', 'Low', 'Close', 'Volume'])
    row = df.tail(1)
    cl = float(row['Close'].values[0])
    amt = 10.0/cl

    amt2 = amt+(amt*0.2)
    myCsvRow = symb+','+str(cl)+','+str(amt)+','+str(amt2)

    with open('minQty.csv','a+') as fd: