Skip to content

spraddles/symfony-panther-brower-automation

Repository files navigation

Prerequisites:

  • php 7.3 or greater
  • composer
  • a paid (non-trial) TradingView account with Pro subscription level

Config:

  • rename the .ENV.EXAMPLE file to just '.ENV'
  • set TV_USERNAME in .ENV file (this is your TradingView username)
  • set TV_PASSWORD in .ENV file (this is your TradingView password)
  • [OPTIONAL] set PANTHER_NO_HEADLESS (set to 0 for no Chrome UI / run in background as opposed to launching a browser)
  • [OPTIONAL] change PANTHER_CHROME_ARGUMENTS to your custom requirements, if you like; you can use any argument so long as ChromeDriver supports it
  • add your Pinescript strategy into TradingView & save it (the exact name is important, take note of this for the $strategyName variable) & update this value
  • your Pinescript will need to include date range code, if you want them in your CSV
  • modify your $strategyName, $exchange, $coins, $dateRanges, $intervals variables in tests/pantherTest.php
  • use the $diagnoseTimer variable to diagnose for issues, key issue is Dusk runs too fast, sometimes you need to slow it down (e.g. $testPause=1500, meaning delay each action by 1.5 seconds)

How to run:

  • open a termnial session (in the project directory) and type in the below commands:
  • composer require --dev dbrekelmans/bdi
  • vendor/bin/bdi detect drivers
  • bin/phpunit tests/pantherTest.php
  • sh ./mustache.sh (for templating)

Output:

  • less combinations of coins, dataranges, and intervals will run faster... and vice versa
  • a new CSV file (Strategy_XXX.csv) will be created in the root directory
  • this file will be overwritten each time the test is run
  • also the CSV is progressively written to, meaning if you refresh the document (close & re-open it) you'll see the new data added, while the browser automation is still running
  • a screenshot PNG file will be created (in the root directory) each time there is an error, so you can see where the automation fails