Newbie question pertaining to API and Cloud Notes

Custom indicators, trading strategies, data export and recording and more...
dgtrade
Posts: 2
Joined: Sat Apr 10, 2021 12:19 pm

Re: Newbie question pertaining to API and Cloud Notes

Post by dgtrade » Sun Apr 18, 2021 9:23 pm

AndreyR wrote:
Tue Jan 12, 2021 9:44 am
hi dmavro,

Do you need horizontal geometrical rays (lines that start and never end, hope I got you right)?

If yes, you can develop a module that will draw those for you. A good starting point is a Bookmap API Tutorial. What you need is everything from the start to (including) "Hello Bookmap addon in 2 minutes". You will learn how to start a project and to make a simple custom module.

Your task may be divided in two:
1) read a CSV file
You may use a library like OpenCSV. Here is a tutorial example. Note, there is a maven project used in the example and you will be using gradle project so your Set-Up will be looking differently (Google how to add a dependency to a gradle project).
So you'll need to read, store and transform the data to numerical values.
2) draw lines
To draw a ray all you need to register an indicator and to draw one point. Please take a look at LastTradeDemoNoHistory at simplified demo strategies.

Hello AndrejR,

Based on Bookmaps Demo class Layer1ApiMarkersDemo.java I adjusted the code a little so that it creates a CanvasIcon based on a csv input file. ( Essentially the CompositeVerticalCoordinate y2 variable value is populated from 
the csv file. In that sense it's a static line attached to price level from csv file).  That works well and Bookmap renders the object as expected (e.g level 16400 pips is converted into 4100 Points on ES Future)

However the code does this only for the first record in the csv file. After processing the first record it does not process more records aka iterating through the file.
I think this is because in line 250 when I return the lastPricePainter object the iteration stops completely.
However based on the CSV file I want to create more objects (each record of the csv should create a 'lastPricePainter' object)

I'm a real java beginner and I would be very greateful if you have an idea at hand on how to solve this problem. I attached the
code , screenshot and an example csv file with 2 records. Any input is much appreciated.

Thank you very much.

Daniel


 
Attachments
lastPricePainter - Object.PNG
lastPricePainter - Object.PNG (51.63 KiB) Viewed 87 times
Layer1ApiLastPricePlankDemo.java
(9.97 KiB) Downloaded 9 times
data.csv
(16 Bytes) Downloaded 7 times

AndreyR
Posts: 377
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 17 times
Been thanked: 69 times

Re: Newbie question pertaining to API and Cloud Notes

Post by AndreyR » Wed Apr 21, 2021 10:56 am

Hi Daniel,
Thx for you code and the screenshot. I made some changes so it produces more than one line now. Pls check and use in your modules.
Attachments
Layer1ApiCsvSSP.java
(8.94 KiB) Downloaded 6 times

Post Reply