White Label Data

Starting with JForex-API 2.6.73 it is possible to retrieve White Label data, e.g., company name, logo and contacts.

package jforex.dataservice;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;

import javax.swing.JFrame;

import com.dukascopy.api.*;

/**
 * An example strategy to test {@link IWLabelData} functionality
 * 
 */
public class GetWhiteLabelData implements IStrategy {

        @Override
        public void onStart(IContext context) throws JFException {
                IConsole console = context.getConsole();
                IDataService dataService = context.getDataService();

                IWLabelData whiteLabelData = dataService.getWhiteLabelData();
                console.getOut().println("Short Name: " + whiteLabelData.getShortName());
                console.getOut().println("Long Name: " + whiteLabelData.getLongName());
                console.getOut().println("URL: " + whiteLabelData.getUrl());
                console.getOut().println("Skype: " + whiteLabelData.getSkype());
                console.getOut().println("Phone: " + whiteLabelData.getPhone());

                showImage("White Label Splash", whiteLabelData.getSplash());
                showImage("White Label Logo", whiteLabelData.getLogo());
                showImage("White Label Splash", whiteLabelData.getIcon());

                context.stop();

        }

        private void showImage(String imageName, BufferedImage image) {
                JFrame splashFrame = new JFrame("White Label Splash");
                splashFrame.add(new MyLoadImage(image));
                splashFrame.pack();
                splashFrame.setVisible(true);
        }

        private class MyLoadImage extends Component {
                private static final long serialVersionUID = -501560241194053927L;

                private Image img;

                public MyLoadImage(Image image) {
                        img = image;
                }

                public void paint(Graphics g) {
                        g.drawImage(img, 0, 0, null);
                }

                public Dimension getPreferredSize() {
                        if (img == null) {
                                return new Dimension(100, 100);
                        } else {
                                return new Dimension(img.getWidth(null), img.getHeight(null));
                        }
                }
        }
        public void onTick(Instrument instrument, ITick tick) throws JFException {}
        public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {}
        public void onMessage(IMessage message) throws JFException {}
        public void onAccount(IAccount account) throws JFException {}
        public void onStop() throws JFException {}
}

GetWhiteLabelData.java

The information on this web site is provided only as general information, which may be incomplete or outdated. Click here for full disclaimer.