ProRealTime
Zone de développement des applications API, des logiciels et utilitaires développés par les membres du forum
Répondre • Page 1 sur 1

Epics + source

par brucy » 05 sept. 2015 02:53

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;


string result_epics = await content_epics.ReadAsStringAsync();
string format_epic = Regex.Replace(result_epics, -"\s+", "");


//if empty , total ascii response is always greater than 143
if (format_epic.Length > 143)
{
{
int indexepic = 0;
string epic = string.Empty;
string Formated = string.Empty;

List<int> indexes = Subcount(format_epic, -"epic""");
List<int> names = Subcount(format_epic, -"name");


if (indexes.Count == names.Count)
{
for (int j = 0; j < indexes.Count; j++)
{
string indexlist = (format_epic.Substring(indexes[j]).Split(',')[0]);
string namelist = (format_epic.Substring(names[j]).Split(',')[0]);
Console.WriteLine(namelist + " " + indexlist);

using (StreamWriter Writer = new StreamWriter(Output, true))
{
await Writer.WriteLineAsync(namelist + " " + indexlist);
}
}
}
}
}
}
}
}
}

Re: Epics + source

par Benoist Rousseau » 05 sept. 2015 07:54

Je te crée un accès FTP aussi rapidement que possible

Re: Epics + source

par Epitaf » 05 sept. 2015 09:21

C'est sympa, mais comment un nombre aussi important s'explique t'il ?

Re: Epics + source

par DarthTrader » 05 sept. 2015 09:32

il y a un paquet d option et de binaire

Re: Epics + source

par swapping » 05 sept. 2015 12:22

Oui, si on enlève les Options, les Binaires et les Sprint Markets çà vas le faire...

Re: Epics + source

par brucy » 21 sept. 2015 09:44

fyi - desole je n'y pensais plus
https://www.andlil.com/api/Epics/

Re: Epics + source

par falex » 21 sept. 2015 11:23

brucy, tu as les epics uniquement depuis un compte FR où tu as aussi les epics des autres pays ?

Sujets similaires
Prélèvement à la source des cotisations sociales
par corentin » 11 déc. 2013 13:52 (4 Réponses)
Source pour se faire une idée sur une entreprise
par Mister Hyde » 16 mai 2015 08:49 (2 Réponses)
L'état pense enfin au Prélèvement impôt à la source
Fichier(s) joint(s) par Rogue » 20 mai 2015 13:50 (18 Réponses)
Un magnétophone, source d'infos précieuses
par Pierre-trading » 13 sept. 2016 10:09 (7 Réponses)
Impôt prélèvement à la source et IFU ?
par falex » 16 avr. 2018 12:06 (5 Réponses)
Pour ou contre le prélèvement à la source ?
par kero » 04 sept. 2018 14:11 (37 Réponses)
Impot à la source
par DarkPoule » 13 sept. 2018 09:32 (3 Réponses)
Source données financières entreprises
par Mouffti » 28 juil. 2019 12:13 (4 Réponses)