Javafx Raspberry Pi StockTicker

My first raspberry pi project i decided to create a stock ticker based on a live feed from the Nairobi Securities Exchange website.

ui stock ticker
I used jsoup for extracting the feed from the NSE web and MatrixPanel control found in the JFXtras library for the display.
The MatrixPanel has three contents green for gainers,red for looser's and yellow for no change.

when setting the MatrixPanel prefSize greater then 700 throws an error on the raspberry pi and doesn't run or not setting the scene width and height.Otherwise the error is thrown but the application runs fine.

 Scene scene = new Scene(root,Color.BLACK);//throws an error glGetError 0x505 doesn't run


sample code


    MatrixPanel matrix_panel = new MatrixPanel();
    matrix_panel.setLedWidth(140);
    matrix_panel.setLedHeight(40);
    matrix_panel.setPrefSize(760,760);

sample code

the gainers content

 Content gainers_cont=new ContentBuilder()    
        .color(Content.MatrixColor.GREEN)
        .type(Content.Type.TEXT)
        .origin(new Point2D(0,5))
        .txtContent(DEFAULT_TEXT)
        .fontGap(Content.Gap.NULL)
        .align(Content.Align.RIGHT)
        .lapse(50)
        .effect(Content.Effect.SCROLL_LEFT)
        .postEffect(Content.PostEffect.REPEAT)
        .pause(300)
        .clear(Boolean.TRUE)
        .build(); 

    matrix_panel.setContents(Arrays.asList(gainers_cont));



The data is fetched after 1 minute delay for the first excecution and 5 minutes interval ,this is done by the ScheduledExecutorService class

Runnable run=() -> {
       //get data  
};
ScheduledExecutorService scheduledExeService =Executors.newSingleThreadScheduledExecutor();
scheduledExeService.scheduleAtFixedRate(run, 60, 300, TimeUnit.SECONDS);

The NseWebParser class does all the data extraction .the application is hosted on github  Javafx-StockTicker

To terminate the application from raspberry pi i first used Platform.exit(); which didn't seem to work  it showed a black screen ,tried System.exit(0); worked fine.

Am sharing my modem internet connection from my pc to the pi with a straight through ethernet cable.

Setting up the raspberry pi for use with javafx i followed these steps,from the oracle website.
To run the application just copy the dist folder on the pi and run the command
java -jar NSEIOTFx.jar





Comments

Post a Comment

Popular Posts