Hello a tous , j'ai decide de trouver un moyen de recuperer TOUT les epics trades sur ig , a la fois a titre d'informations et pour recherche personelle.
La quantitee est remarquable (au dela de 400000 ) ,
A vrai dire je ne peux meme pas copier le resultat sur le forum sans faire planter firefox ,
et ne passe pas par l'api officielle , egalement pour cause de crash/blacklist server , partant de la methode browse et marketDetails apres une trentaine de tentatives... :musique:
Pour ceux que ca interesse a des fins de developpement ou autres, envoyez moi un mp pour le fichier txt , ou autrement si benoist me donner un acces ftp.
Il est formate de la sorte ,
name":"Germany3010700PUT" epic":"OP.D.DAXWEEK.10700P.IP"
name":"Germany3010750CALL" epic":"OP.D.DAXWEEK.10750C.IP"
name":"Germany3010750PUT" epic":"OP.D.DAXWEEK.10750P.IP"
name":"Bitcoin($)tobeabove110" epic":"PB.D.BINMBIT.MBIT20.IP"
name":"Bitcoin($)tobeabove130" epic":"PB.D.BINMBIT.MBIT19.IP"
name":"Bitcoin($)tobeabove150" epic":"PB.D.BINMBIT.MBIT18.IP"
name":"Bitcoin($)tobeabove160" epic":"PB.D.BINMBIT.MBIT17.IP"
name":"Bitcoin($)tobeabove170" epic":"PB.D.BINMBIT.MBIT16.IP"
name":"Bitcoin($)tobeabove180" epic":"PB.D.BINMBIT.MBIT15.IP"
name":"Bitcoin($)tobeabove190" epic":"PB.D.BINMBIT.MBIT14.IP"
name":"Bitcoin($)tobeabove200" epic":"PB.D.BINMBIT.MBIT13.IP"
name":"Bitcoin($)tobeabove210" epic":"PB.D.BINMBIT.MBIT12.IP"
name":"Bitcoin($)tobeabove220" epic":"PB.D.BINMBIT.MBIT11.IP"
name":"Aluminium" epic":"CS.D.ALUMINIUM.cfd à risque limité.IP"
name":"Copper" epic":"CS.D.COPPER.cfd à risque limité.IP"
name":"HighGradeCopper" epic":"coucou.D.HG.UNC.IP"
name":"Lead" epic":"CS.D.LEAD.cfd à risque limité.IP"
name":"Nickel" epic":"CS.D.NICKEL.cfd à risque limité.IP"
name":"Zinc" epic":"CS.D.ZINC.cfd à risque limité.IP"
name":"HighGradeCopper" epic":"MT.D.HG.FWS1.IP"
..............etc etc
Spoiler:
namespace CEpics
{
internal class Program
{
private static void Main(string[] args)
{
XSECURITYTOKEN = ""; //Your X-security-token , found in IG's API companion headers
CST = ""; //Your CST token , found in IG's API companion headers
Output = -"D:\\log.txt"; // Here is the output file path
Task web = new Task(GetThemTask);
web.Start();
Console.WriteLine("Gettings Instruments...");
Console.ReadLine();
}
public static string ID { get; set; }
public static string XSECURITYTOKEN { get; set; }
public static string CST { get; set; }
public static string Output { get; set; }
public static Uri URI { get; set; }
public static List<int> Subcount(string str, string value)
{
if (String.IsNullOrEmpty(value))
throw new ArgumentException("the string to find may not be empty", "value");
List<int> indexes = new List<int>();
for (int index = 0;; index += value.Length)
{
index = str.IndexOf(value, index);
if (index == -1)
return indexes;
indexes.Add(index);
}
}
private static async void GetThemTask()
{
//creates and sets a security cookie for httpclient
HttpClientHandler handler = new HttpClientHandler();
handler.CookieContainer = new CookieContainer();
HttpClient client = new HttpClient(handler);
Uri uri_epics =
new Uri(URI);
handler.CookieContainer.Add(uri_epics,
new Cookie("X-SECURITY-TOKEN", XSECURITYTOKEN));
// Adding a Cookie
handler.CookieContainer.Add(uri_epics,
new Cookie("CST", CST));
//Total range of instrument's index is arbitrarily located between 50k and 500k...using a brute force approach.
for (int i = 95000; i < 500000; i++)
{
ID = i.ToString();
string epic_url =
String.Format(
"/hiearchyid.htm?hierarchyId={0}&epic=&sort=&dir=asc&view=jsonView",
i.ToString()); //+IG DOMAIN here
Uri uri_epic = new Uri(epic_url);
HttpResponseMessage response_epics = await client.GetAsync(uri_epic);
HttpContent content_epics = response_epics.Content;