All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.barrybecker4.simulation.trading.model.tradingstrategy.BuyAndHoldStrategy Maven / Gradle / Ivy

There is a newer version: 1.6.2
Show newest version
/** Copyright by Barry G. Becker, 2015. Licensed under MIT License: http://www.opensource.org/licenses/MIT  */
package com.barrybecker4.simulation.trading.model.tradingstrategy;


/**
 * This naive strategy puts everything in the market at the start and sells it all at the end.
 *
 * @author Barry Becker
 */
public class BuyAndHoldStrategy extends AbstractTradingStrategy {


    public String getName() {
        return "buy and hold";
    }

    public String getDescription() {
        return "No transactions are made after the initial investment";
    }

    /**
     * do nothing
     */
    @Override
    public MarketPosition updateInvestment(double stockPrice) {

        invested = sharesOwned * stockPrice;
        return new MarketPosition(invested, reserve, sharesOwned);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy