Page tree
Skip to end of metadata
Go to start of metadata

Schedule API

To request trading hours, use Schedule API.

Example

import com.dxfeed.ipf.InstrumentProfile;
import com.dxfeed.ipf.InstrumentProfileReader;
import com.dxfeed.schedule.Schedule;
import com.dxfeed.schedule.SessionFilter;

import java.io.IOException;
import java.util.List;

public class TradingHoursReadingFromIPF {
    public static void main(String[] args) {
        try {
            String URL = "https://tools.dxfeed.com/ipf?SYMBOL=*/PAZ20:XNYM*";
            String login = "login";
            String password = "password";
            List<InstrumentProfile> profiles = new InstrumentProfileReader().readFromFile(URL, login, password);
            for (InstrumentProfile instrumentProfile : profiles) {
                Schedule schedule = Schedule.getInstance(instrumentProfile);
                System.out.println(instrumentProfile.getSymbol() + " " + schedule.toString() + " " +
                        schedule.getNearestSessionByTime(System.currentTimeMillis(), SessionFilter.REGULAR));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}