How to acquire information from the IEC (Investor’s Electronic Channel)?

Asked

Viewed 7,609 times

8

Forgive my layperson, but there is an API that allows me to pull a user negotiations, knowing the login and password of the same ?

Or would it be the case to make a Crawler ?

I’ve seen several services like Kinvo and Trademap has this functionality, and I was interested in trying to implement in a spreadsheet, as you would ?

  • I need to do the same thing in python... by the way you already did?

1 answer

4


Sportacub good night, has yes. Using Excel VBA. I am also user, beginner, CEI. Maybe help that I will give you is partial, enter the CEI with VBA but I hope with this we start a learning journey together, I will also learn how to use and automating some things and helping you with this.

First step is to configure references.

in the VBA IDE go to Tools > References then check the options: Microsoft Internet Controls and Microsoft HTML Object Library

Follow the code, just run.

Const url_CEI As String = "https://cei.b3.com.br/CEI_Responsivo/"

Const CPF_CNPJ As String = "<seu CPF/CNPJ>"
Const Senha As String = "<sua senha>

Sub CEI_Bot()

    Dim objIE As InternetExplorer
    Dim aEle As HTMLLinkElement
    Dim y As Integer
    Dim result As String

    Set objIE = New InternetExplorer

    objIE.Visible = True

    objIE.navigate url_CEI

    Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop

        'CPF/CNPJ
        Set htmlDoc = objIE.document
        Set htmlColl = htmlDoc.getElementsByTagName("INPUT")
        For Each htmlInput In htmlColl
            If htmlInput.Name = "ctl00$ContentPlaceHolder1$txtLogin" Then
                htmlInput.Value = CPF_CNPJ
                Exit For
            End If
        Next htmlInput

        'Senha
        For Each htmlInput In htmlColl
            If htmlInput.Name = "ctl00$ContentPlaceHolder1$txtSenha" Then
                htmlInput.Value = Senha
                Exit For
            End If
        Next htmlInput

        'Entrar
        For Each htmlInput In htmlColl
            If htmlInput.Name = "ctl00$ContentPlaceHolder1$btnLogar" Then
                htmlInput.Click
                Exit For
            End If
        Next htmlInput
End Sub
  • 2

    Thank you very much Paulo, gave me a great light of the process !

Browser other questions tagged

You are not signed in. Login or sign up in order to post.