Package pl.com.external.essw.office
Class Trader
- java.lang.Object
-
- pl.com.external.essw.office.Trader
-
- All Implemented Interfaces:
java.lang.Runnable
public class Trader extends java.lang.Object implements java.lang.Runnable
-
-
Field Summary
Fields Modifier and Type Field Description protected Consoleconsoleprotected DatabaseFacadedatabaseFacadeprotected Managermanagerprotected Period[]periodArray
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuySomething(Investment investment)protected voidcalculateIndicators(Period period)protected voidcheckCommandments()protected PeriodcreateFirstPeriod(Transaction transaction)protected PeriodcreateNewPeriod(java.time.LocalDateTime startDime, Transaction transaction)protected voidevaluateBuyPriceDropRatio(java.util.List<Session> dataSessionList, java.lang.Double buyPriceDropRatio)protected voidevaluateBuyVolumeSpike(java.util.List<Session> dataSessionList, java.lang.Integer buyVolumeSpike, java.lang.Double buyPriceDropRatio)protected voidevaluateWiggle(java.util.List<Session> dataSessionList, java.lang.Double wiggle, java.lang.Integer buyVolumeSpike, java.lang.Double buyPriceDropRatio)InvestmentgetInvestment()PeriodgetLastFullPeriod()PeriodgetLastPeriod()protected voidlogTestSessions(java.lang.String tradedStockTicker, java.util.List<Session> dataSessionList)protected booleanmoneyAwailable(Transaction transaction)voidrun()protected booleansellIfLastTransactionData(int transactionNumber, int transactionCount)static booleanskipProcessing(Stock stock)protected voidspikePrice(Investment investment, java.lang.Double price)protected voidstartPeriodsArray(Transaction transaction, int periodIntervalMinutes)protected voidupdateHighPrice(Period period, Transaction transaction)protected voidupdateLowPrice(Period period, Transaction transaction)protected PeriodupdatePeriodsList(Transaction transaction, int periodIntervalMinutes, boolean newSesion)protected voidupdatePrice(Investment investment, Transaction transaction)protected voidupdateVolume(Period period, Transaction transaction)protected voidupdateVolumeChunkCounter(Period period, java.lang.Long volume)
-
-
-
Field Detail
-
manager
protected Manager manager
-
databaseFacade
protected DatabaseFacade databaseFacade
-
periodArray
protected Period[] periodArray
-
console
protected Console console
-
-
Method Detail
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
evaluateWiggle
protected void evaluateWiggle(java.util.List<Session> dataSessionList, java.lang.Double wiggle, java.lang.Integer buyVolumeSpike, java.lang.Double buyPriceDropRatio)
-
skipProcessing
public static boolean skipProcessing(Stock stock)
-
getInvestment
public Investment getInvestment()
- Returns:
- the investment
-
buySomething
public void buySomething(Investment investment)
-
calculateIndicators
protected void calculateIndicators(Period period)
-
sellIfLastTransactionData
protected boolean sellIfLastTransactionData(int transactionNumber, int transactionCount)
-
spikePrice
protected void spikePrice(Investment investment, java.lang.Double price)
-
startPeriodsArray
protected void startPeriodsArray(Transaction transaction, int periodIntervalMinutes)
-
updateHighPrice
protected void updateHighPrice(Period period, Transaction transaction)
-
updateLowPrice
protected void updateLowPrice(Period period, Transaction transaction)
-
updatePeriodsList
protected Period updatePeriodsList(Transaction transaction, int periodIntervalMinutes, boolean newSesion)
-
updatePrice
protected void updatePrice(Investment investment, Transaction transaction)
-
updateVolume
protected void updateVolume(Period period, Transaction transaction)
-
updateVolumeChunkCounter
protected void updateVolumeChunkCounter(Period period, java.lang.Long volume)
-
createNewPeriod
protected Period createNewPeriod(java.time.LocalDateTime startDime, Transaction transaction)
-
createFirstPeriod
protected Period createFirstPeriod(Transaction transaction)
-
getLastFullPeriod
public Period getLastFullPeriod()
- Returns:
-
getLastPeriod
public Period getLastPeriod()
- Returns:
-
logTestSessions
protected void logTestSessions(java.lang.String tradedStockTicker, java.util.List<Session> dataSessionList)
-
evaluateBuyPriceDropRatio
protected void evaluateBuyPriceDropRatio(java.util.List<Session> dataSessionList, java.lang.Double buyPriceDropRatio)
-
evaluateBuyVolumeSpike
protected void evaluateBuyVolumeSpike(java.util.List<Session> dataSessionList, java.lang.Integer buyVolumeSpike, java.lang.Double buyPriceDropRatio)
-
moneyAwailable
protected boolean moneyAwailable(Transaction transaction)
-
checkCommandments
protected void checkCommandments()
-
-