IG-Group/ig-webapi-java-sample


Java sample application to access the IG Web API

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.IG-Group:ig-webapi-java-sample:'
	}
	dependencies {
		implementation("com.github.IG-Group:ig-webapi-java-sample:")
	}
	<dependency>
	    <groupId>com.github.IG-Group</groupId>
	    <artifactId>ig-webapi-java-sample</artifactId>
	    <version></version>
	</dependency>

                            
    libraryDependencies += "com.github.IG-Group" % "ig-webapi-java-sample" % ""
        
        

                            
    :dependencies [[com.github.IG-Group/ig-webapi-java-sample ""]]
        
        

Readme


🚧 Notice

Date: 2024 August

This repository is now deprecated and may be removed/replaced at a later date.

IG Web API Java Sample

Build Status

Overview

This repository contains two simple Java console sample applications which access the IG REST and Streaming APIs:

1) ig-webapi-java-sample-console: A basic console based application which logs in via /session V2, retrieves a list of position, watchlist, subscribes to lightstreamer and create a position.

2) ig-webapi-java-sample-console-ui: A UI based console application (please increase the windows size to prevent scrolling) which shows a graph with the current market price and allows user to place a trade. Authentication is via /session V3.

Getting started

1) Set the destination IG environment in environment.properties.

2) Open a command line / shell prompt and run mvn clean to install the Lighstreamer client in ig-webapi-java-client/lib to your local maven repository.

3) Run mvn clean install to build the project.

4.a) Run basic console app:

    cd ig-webapi-java-sample-console
    java -jar target/ig-webapi-java-sample-console-<project version>.jar <username> <password> <api key>

4.b) Run UI based console app

    cd ig-webapi-java-sample-console-ui
    java -jar target/ig-webapi-java-sample-console-ui-<project version>.jar <username> <password> <api key> [<optional epic>]

To attach a remote debugger: java -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y -jar target/ig-webapi-java-sample-console...