{"id":37073271,"url":"https://github.com/iqoptionapi/iqoptionapi","last_synced_at":"2026-01-14T08:36:03.405Z","repository":{"id":41744220,"uuid":"248145300","full_name":"iqoptionapi/iqoptionapi","owner":"iqoptionapi","description":"IQ Option API (Python 3.7.2) - supported by community - ONLY FOR STUDY - Don't use it on your real Account!!! ","archived":false,"fork":true,"pushed_at":"2024-08-12T00:58:23.000Z","size":8278,"stargazers_count":264,"open_issues_count":54,"forks_count":189,"subscribers_count":40,"default_branch":"master","last_synced_at":"2025-10-27T04:22:59.623Z","etag":null,"topics":["iq","iq-option-api","iqoption","iqoption-api","iqoption-bot","iqoptionapi","trading"],"latest_commit_sha":null,"homepage":"https://iqoptionapi.github.io/iqoptionapi/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"evecimar/iqoptionapi","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iqoptionapi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"https://streamelements.com/iqoptionapi/tip"}},"created_at":"2020-03-18T05:21:11.000Z","updated_at":"2025-10-25T23:01:02.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/iqoptionapi/iqoptionapi","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/iqoptionapi/iqoptionapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iqoptionapi%2Fiqoptionapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iqoptionapi%2Fiqoptionapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iqoptionapi%2Fiqoptionapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iqoptionapi%2Fiqoptionapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iqoptionapi","download_url":"https://codeload.github.com/iqoptionapi/iqoptionapi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iqoptionapi%2Fiqoptionapi/sbom","scorecard":{"id":494126,"data":{"date":"2025-08-11","repo":{"name":"github.com/iqoptionapi/iqoptionapi","commit":"8a903cc094a74af1ed935a56a2d6b5a9ed3319d7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Code-Review","score":1,"reason":"Found 4/26 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":5,"reason":"5 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2014-14 / GHSA-652x-xj99-gmcc","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2014-13 / GHSA-cfj3-7x9c-4p3h","Warn: Project is vulnerable to: PYSEC-2018-28 / GHSA-x84v-xcm2-53pg"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/iqoptionapi/iqoptionapi/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/iqoptionapi/iqoptionapi/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/iqoptionapi/iqoptionapi/test.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/test.yml:31","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}}]},"last_synced_at":"2025-08-19T20:00:29.907Z","repository_id":41744220,"created_at":"2025-08-19T20:00:29.907Z","updated_at":"2025-08-19T20:00:29.907Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28414549,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:31:27.429Z","status":"ssl_error","status_checked_at":"2026-01-14T08:31:19.098Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["iq","iq-option-api","iqoption","iqoption-api","iqoption-bot","iqoptionapi","trading"],"created_at":"2026-01-14T08:36:02.741Z","updated_at":"2026-01-14T08:36:03.397Z","avatar_url":"https://github.com/iqoptionapi.png","language":"Python","funding_links":["https://streamelements.com/iqoptionapi/tip"],"categories":[],"sub_categories":[],"readme":"## AJUDE A MANTER O PROJETO ATIVO\nEN: HELP KEEPING THIS PROJECT ACTIVE \u003cbr\u003e\n\nPara manter o projeto continuamente atualizado contribua com uma doação, com alguma correção ou melhoria.\n\nAs doações serão usadas para adicionar novas features citadas abaixo.\n\nhttps://streamelements.com/iqoptionapi/tip\n\u003cbr\u003e\u003cbr\u003e\n## Español - AYUDA A MANTENER ESTE PROYECTO ACTIVO \nPara mantener el proyecto continuamente actualizado, contribuye con una donación, con cualquier corrección o mejora.\n\nLas donaciones se utilizarán para agregar nuevas funciones que se mencionan a continuación.\n\nEN: To keep the project continuously updated you can contribute with a donation or with some correction or improvement.\n\nhttps://streamelements.com/iqoptionapi/tip\n\u003cbr\u003e\u003cbr\u003e\n\n## HELP KEEPING THIS PROJECT ACTIVE\n\nTo keep project continuously updated, contribute with a donation, with any correction or improvement.\n\nDonations will be used to add new features mentioned below.\n\nhttps://streamelements.com/iqoptionapi/tip\n\u003cbr\u003e\u003cbr\u003e\n\n## PLANEJAMENTO DE NOVAS FEATURES \nEN: NEW FEATURES PLANNING\u003cbr\u003e\nES: PLANIFICACIÓN DE NUEVAS CARACTERÍSTICAS\n\n\n- CALENDARIO ECONOMICO / ECONOMIC CALENDAR (UNDER DEVELOPMENT)\n\u003cbr\u003e\u003cbr\u003e\nDescrição: \nPega o calendario econimico da iqoption.\nEssa feature vai possibilitar que vocês possar evitar fazer operações quando estiver muito arriscado.\n\u003cbr/\u003e\u003cbr/\u003e\n\n![ECONOMIC CALENDAR](image/econimic_calendar.png)\n\u003cbr/\u003e\n\n- FEED DE NOTICIAS/ NEWS FEED \n\u003cbr\u003e\u003cbr\u003e\nDescrição: \nNoticias sobre o mercado \n![NEWS FEED](image/news_feed.png)\n\u003cbr/\u003e\u003cbr/\u003e\n\n## IQOPTION API SUPPORTED BY COMMUNITY\n\nThis api is intended to be an open source project to communicate with iqOption site.\nthis is a no official repository, it means it is maintained by community\n\nEsta API é destinada a ser um projeto de código aberto para se comunicar com o site da iqOption.\neste é um repositório não oficial, significa que é mantido pela comunidade\n\nEsta API está destinada a ser un proyecto de código abierto para comunicarse con el sitio de IqIoption.\neste es un repositorio no oficial, significa que es mantenido por la comunidad\n\n\n### IMPORTANT NOTE / NOTA IMPORTANTE \n\nDue to the large amount of scammers that have appeared in the market, it is recommended that you DO NOT enter your password into an unknown exe or robot site that operates on iqoption because many of those have stolen people's passwords so be careful. It's best if you develop your robot or hire someone you trust.\n\nDevido a grande quantidade de golpistas que tem aparecido no mercado, recomenda-se que você NÃO inserir sua senha em exe ou sites de robo desconhecidos que opera na iqoption porque muitos desses tem roubado as senhas das pessoas então tomem cuidado. O melhor é você desenvolver seu robo ou contratar alguem de confiança. \n\n### Canal no youtube explicando com trabalhar com a api\n\nKodandao com Faria \n\nhttps://www.youtube.com/channel/UCetDOTbLD_gCy0aI4aQwMsg\n\n\u003cdiv align=\"center\"\u003e\n\t\u003ch2\u003e Idiomas | Languages \u003c/h2\u003e\n\t\u003ca href=\"https://iqoptionapi.github.io/iqoptionapi/pt/\"\u003e\n\t\t\u003cimg src=\"doc/image/flags/br.png \"\n\t\talt=\"Português\" width=\"50\" height=\"50\" /\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://iqoptionapi.github.io/iqoptionapi/es/\"\u003e\n\t\t\u003cimg src=\"doc/image/flags/es.png \"\n\t\talt=\"Espanol\" width=\"50\" height=\"50\" /\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://iqoptionapi.github.io/iqoptionapi/en/\"\u003e\n\t\t\u003cimg src=\"doc/image/flags/en.png \"\n\t\talt=\"English\" width=\"50\" height=\"50\" /\u003e\n\t\u003c/a\u003e\n\u003c/div\u003e\u003cbr\u003e\u003cbr\u003e\n\nThis api is based on [Lu-Yi-Hsun](https://github.com/Lu-Yi-Hsun/iqoptionapi/)\n\nThanks also for [this version](https://github.com/evecimar/iqoptionapi) he fixed some bugs.\n\nIt was not been updated by him.\nSo I decided to study and do this work.\nI don't know how all works yet but I'll learn and teach you\n\n## Summary\n\n- [Contribute with Community](#contribe)\n- [Python version 3.7](#pythonversion)\n- [How to start](#howtostart)\n- [How to get Technical Indicators](#technicalindicators)\n\n## Live documentation\n\n[documentation](https://iqoptionapi.github.io/iqoptionapi/)\n\n\u003cdiv id='contribe'/\u003e\n\n## Contribute with Community\n\nHelp me to keep this project working. Open relevant issues and give a hand to fix the bug.\nI'll start a channel on youtube in future as soon as possible to share how I'm working with this project.\nThe channel will be in portuguese but you can help with subtitles.\n\nI'll do lives on twitch to work together with you. And if you enjoy it and could contribute with any donation it will be welcome.\n\nIf something is not clear on documentation let me know and I'll try to explain what I know.\n\nPlease send me suggestions ... feedbacks are welcome\n\n\u003cdiv id='pythonversion'/\u003e\n\n### PYTHON VERSION\n\nI'm using this tools anaconda with python 3.7 with contains a lot of libs pre-installed\n\n\u003cdiv id='howtostart'/\u003e\n\n## How to start\n\nYou must have python installed version 3.7 or higher\n\nthen you must have websocket-client installed on your project\n\n```python\npip install websocket-client==0.56\n```\n\nNow you can install this project as library:\n\n```bash\nsudo pip install -U git+git://github.com/iqoptionapi/iqoptionapi.git\n\nOR \n\npip install -U https://github.com/iqoptionapi/iqoptionapi/archive/refs/heads/master.zip\n```\n\n```Python\n# Alto Nivel\nfrom iqoptionapi.stable_api import IQ_Option\n\n# Baixo Nivel\nfrom iqoptionapi.api import IQOptionAPI\n```\n\n```bash\n.\n├── docs\n├── iqoptionapi(Código da API)\n    ├── http(Realiza requisições HTTP GET/POST)\n    └── ws\n        ├── chanels(Doing websocket action)\n        └── objects(Get back data from websocket action)\n```\n\n## Can not loging problem\n\n#### fix way 1\n\n```bash\nsudo pip3 uninstall websocket-client\nsudo pip3 install websocket-client==0.56\n```\n\n### problem 2\n\n#### websocket conflict with websocket-client\n\nif you have this problem\n\nhttps://github.com/Lu-Yi-Hsun/iqoptionapi/issues/66\n\nfix way\n\n```bash\nsudo pip3 uninstall websocket\nsudo pip3 install websocket-client==0.47.0\n```\n\n---\n\n## Littile sample\n\n```python\nimport time\nfrom iqoptionapi.stable_api import IQ_Option\nIq=IQ_Option(\"email\",\"password\")\ngoal=\"EURUSD\"\nprint(\"get candles\")\nprint(Iq.get_candles(goal,60,111,time.time()))\n```\n\n---\n\n## Funções e exemplos\n\n### Import\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\n```\n\n---\n\n### Debug mode on\n\n### Debug\n\nLigado\n\n```python\nimport logging\nlogging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')\n```\n\n---\n\n### Login\n\n!!!\n\nLogin NOT support SMS Authorization yet\n\nI suggest close it because your robot will stop to wait you to check sms code (on phone)....\n\n!!!\n\nDesligado\n\n```python\nIq=IQ_Option(\"email\",\"password\")\n```\n\n---\n\n### \u003ca id=setmaxreconnect\u003eset_max_reconnect\u003c/a\u003e\n\ndefault number is 5\n\nhttps://github.com/Lu-Yi-Hsun/iqoptionapi/issues/22\n\n## Como realizar login\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\n\nAPI = IQ_Option(\"email\", \"senha\")\n```\n\nIq.set_max_reconnect(number)\n\n````\n\n---\n\n### Reconnect\u0026check connect\n\n\n### Reconectar e checar se está conectado\n\nCaso ocorra algum erro e a conexão com a IQ seja perdida, você pode estar implementando isto\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nimport time\nlogging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')\nIq=IQ_Option(\"email\",\"password\")\nIq.set_max_reconnect(-1)#allow unlimited reconnect\nwhile True:\n    #you can !!close yuor network!! to simulation network fails\n    if Iq.check_connect()==False:#detect the websocket is close\n        print(\"try reconnect\")\n        Iq.connect()#try to connect\n        print(\"reconnect Success\")\n    time.sleep(1)\n````\n\n---\n\n## Como realizar login com 2 fatores\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\n\nprint(\"Conectando...\")\napi = IQ_Option(\"email\", \"password\")\nstatus, reason = api.connect()\nprint('##### Primeira tentativa #####')\nprint('Status:', status)\nprint('Reason:', reason)\nprint(\"Email:\", api.email)\n\nif reason == \"2FA\":\n    print('##### 2FA HABILITADO #####')\n    print(\"Um sms foi enviado com um código para seu número\")\n\n    code_sms = input(\"Digite o código recebido: \")\n    status, reason = api.connect_2fa(code_sms)\n\n    print('##### Segunda tentativa #####')\n    print('Status:', status)\n    print('Reason:', reason)\n    print(\"Email:\", api.email)\n\nprint(\"Banca:\", api.get_balance())\nprint(\"##############################\")\n```\n\n### Check version\n\n### Tipo de conta e banca\n\n#### Retornar sua banca com get_balance()\n\n```python\nAPI.get_balance()\n```\n\n### \u003ca id=checkconnect\u003e Check connect\u003c/a\u003e\n\n#### Resetar conta de TREINAMENTO (10k)\n\nFunção para resetar a conta de treinamento(depositar os 10k de testes)\n\n```python\nprint(Iq.check_connect())\n```\n\n### \u003ca id=reconnect\u003eReconnect\u003c/a\u003e\n\n```python\nIq.connect()\n```\n\n### \u003ca id=payout_digital\u003eNova função de captura payout digital\u003c/a\u003e\n\n---\n\n```python\nactive = 'EURUSD'\npayout = Iq.get_digital_payout(active)\nprint(payout)\n```\n\n---\n\n### \u003ca id=by_payout_digital\u003eNova função de abertura de ordem na digital\u003c/a\u003e\n\n---\n\n```python\nactive = 'EURUSD'\namount = 100.0\naction = 'CALL'\nduration = 1\nstatus, order_id = Iq.buy_digital_spot_v2(active, amount, action, duration)\nprint(status, order_id)\n```\n\n---\n\n```python\nactive = 'EURUSD'\npayout = Iq.get_digital_payout(active)\nprint(payout)\n```\n\n---\n\n### Retornar ativos e verificar se estão aberto\n\nATENÇÃO: Tome cuidado, get_all_open_time() é pesado para a internet\n\n- Função get_all_open_time() retorna um DICT\n- \"cfd\" inclue ações,Commodities e ativos de ETFs\n\nDICT[\"forex\"/\"cfd\"/\"crypto\"/\"digital\"/\"turbo\"/\"binary\"][asset name][\"open\"]\n\nit will return True/False\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nimport logging\nimport random\nlogging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')\nIq=IQ_Option(\"email\",\"password\")\nALL_Asset=Iq.get_all_open_time()\n#check if open or not\nprint(ALL_Asset[\"forex\"][\"EURUSD\"][\"open\"])\nprint(ALL_Asset[\"cfd\"][\"FACEBOOK\"][\"open\"])#Stock,Commodities,ETFs\nprint(ALL_Asset[\"crypto\"][\"BTCUSD-L\"][\"open\"])\nprint(ALL_Asset[\"digital\"][\"EURUSD-OTC\"][\"open\"])\n\n#Binary have two diffenence type:\"turbo\",\"binary\"\nprint(ALL_Asset[\"turbo\"][\"EURUSD-OTC\"][\"open\"])\nprint(ALL_Asset[\"binary\"][\"EURUSD-OTC\"][\"open\"])\n\nATIVOS = API.get_all_open_time()\n\n#Checando se está aberto ou não\nprint(ATIVOS[\"forex\"][\"EURUSD\"][\"open\"])\nprint(ATIVOS[\"cfd\"][\"FACEBOOK\"][\"open\"]) #Ações,Commodities e ETFs\nprint(ATIVOS[\"crypto\"][\"BTCUSD-L\"][\"open\"])\nprint(ATIVOS[\"digital\"][\"EURUSD-OTC\"][\"open\"])\n\n#Binarias tem dois modos diferentes: \"turbo\" e \"binary\"\nprint(ALL_Asset[\"turbo\"][\"EURUSD-OTC\"][\"open\"])\nprint(ALL_Asset[\"binary\"][\"EURUSD-OTC\"][\"open\"])\n```\n\n### View all ACTIVES Name\n\nyou will get right all ACTIVES and code\n\n[ACTIVES](iqoptionapi/constants.py)\n\nPara exibir todas os ativos\n\n```python\nprint(Iq.get_all_ACTIVES_OPCODE())\n```\n\nfor tipo, data in ATIVOS.items():\nfor ativo_nome,value in data.items():\nprint(tipo,ativo_nome,value[\"open\"])\n\n````\n---\n\n### Ver o nome e ID de todos os ativos\n- [Arquivo com lista de ativos e id's](iqoptionapi/constants.py)\n\n```python\nprint(API.get_all_ACTIVES_OPCODE())\n````\n\n---\n\nget the order data by id\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nimport time\n#logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')\nIq=IQ_Option(\"email\",\"password\")\n\nACTIVES=\"EURUSD\"\nduration=1#minute 1 or 5\namount=1\naction=\"call\"#put\n\nprint(\"__For_Binary_Option__\")\n_,id=Iq.buy(amount,ACTIVES,action,duration)\nwhile Iq.get_async_order(id)==None:\n    pass\nprint(Iq.get_async_order(id))\nprint(\"\\n\\n\")\n\nprint(\"__For_Digital_Option__spot\")\nid=Iq.buy_digital_spot(ACTIVES,amount,action,duration)\nwhile Iq.get_async_order(id)==None:\n    pass\norder_data=Iq.get_async_order(id)\nprint(Iq.get_async_order(id))\nprint(\"\\n\\n\")\n```\n\nprint(\"\\_\\_For_Forex_Stock_Commodities_Crypto_ETFs\")\ninstrument_type=\"crypto\"\ninstrument_id=\"BTCUSD\"\nside=\"buy\"\namount=1.23\nleverage=3\ntype=\"market\"\nlimit_price=None\nstop_price=None\nstop_lose_kind=\"percent\"\nstop_lose_value=95\ntake_profit_kind=None\ntake_profit_value=None\nuse_trail_stop=True\nauto_margin_call=False\nuse_token_for_commission=False\ncheck,id=Iq.buy_order(instrument_type=instrument_type, instrument_id=instrument_id,\nside=side, amount=amount,leverage=leverage,\ntype=type,limit_price=limit_price, stop_price=stop_price,\nstop_lose_value=stop_lose_value, stop_lose_kind=stop_lose_kind,\ntake_profit_value=take_profit_value, take_profit_kind=take_profit_kind,\nuse_trail_stop=use_trail_stop, auto_margin_call=auto_margin_call,\nuse_token_for_commission=use_token_for_commission)\nwhile Iq.get_async_order(id)==None:\npass\norder_data=Iq.get_async_order(id)\nprint(Iq.get_async_order(id))\n\n````\n\n### For Options\n\n```python\nAPI.get_traders_mood(Paridade)\n\t# Retorno: Sera do tipo float que representa em porcentagem os 'calls'\n\t# Se você quiser saber a porcentagem de put, tente 100-API.get_traders_mood(Paridade)\n````\n\nSample\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nimport time\nlogging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')\nIq=IQ_Option(\"email\",\"pass\")\ngoal=\"EURUSD\"\nprint(\"get candles\")\nprint(Iq.get_candles(goal,60,111,time.time()))\nMoney=1\nACTIVES=\"EURUSD\"\nACTION=\"call\"#or \"put\"\nexpirations_mode=1\n\nIq.buy(Money,ACTIVES,ACTION,expirations_mode)\n```\n\nExplicação\n\n```python\nIq.buy(Money,ACTIVES,ACTION,expirations)\n                #Money:How many you want to buy type(int)\n                #ACTIVES:sample input \"EURUSD\" OR \"EURGBP\".... you can view by get_all_ACTIVES_OPCODE\n                #ACTION:\"call\"/\"put\" type(str)\n                #expirations:input minute,careful too large will false to buy(Closed market time)thank Darth-Carrotpie's code (int)https://github.com/Lu-Yi-Hsun/iqoptionapi/issues/6\n                #return:(None/id_number):if sucess return (id_number) esle return(None) 2.1.5 change this\n```\n\n#### \u003ca id=buymulti\u003ebuy_multi\u003c/a\u003e\n\nSample\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nIq=IQ_Option(\"email\",\"password\")\nMoney=[]\nACTIVES=[]\nACTION=[]\nexpirations_mode=[]\n\nEntrada.append(1)\nParidade.append(\"EURUSD\")\nDirecao.append(\"call\") # ou put\nDuracao.append(1)\n\nEntrada.append(1)\nParidade.append(\"EURAUD\")\nDirecao.append(\"call\")#put\nDuracao.append(1)\n\nprint(\"buy multi\")\nid_list=Iq.buy_multi(Money,ACTIVES,ACTION,expirations_mode)\n\nprint(\"check win only one id (id_list[0])\")\nprint(Iq.check_win_v2(id_list[0]))\n```\n\n---\n\n#### Tempo restante para operação com get_remaning()\n\nFormula: tempo de compra = tempo restante - 30\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nIq=IQ_Option(\"email\",\"password\")\nMoney=1\nACTIVES=\"EURUSD\"\nACTION=\"call\"#or \"put\"\nexpirations_mode=1\nwhile True:\n    remaning_time=Iq.get_remaning(expirations_mode)\n    purchase_time=remaning_time-30\n    if purchase_time\u003c4:#buy the binary option at purchase_time\u003c4\n        Iq.buy(Money,ACTIVES,ACTION,expirations_mode)\n        break\n```\n\n#### Vender operação com sell_option()\n\nO ID('s) passados para o sell_option() devem ser int ou um list contendo os id's\n\n```python\nIq.sell_option(sell_all)#input int or list\n```\n\nExemplo\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nimport time\nprint(\"login...\")\nIq=IQ_Option(\"email\",\"password\")\n\nAPI = IQ_Option(\"email\", \"password\")\n\nEntrada = 1\nParidade = \"EURUSD\"\nDirecao = \"call\"\nDuracao = 1\n\nid=Iq.buy(Money,ACTIVES,ACTION,expirations_mode)\nid2=Iq.buy(Money,ACTIVES,ACTION,expirations_mode)\n\ntime.sleep(5)\n\nsell_all=[]\nsell_all.append(id)\nsell_all.append(id2)\nprint(Iq.sell_option(sell_all))\n```\n\n#### check win\n\nprint(API.sell_option(sell_all))\n\n````\n\n#### Verificar resultado da operação nas **BINÁRIA**\n\n\u003e As funções check_win() e check_win_v2() pararam de funcionar\n\nPara pegarmos o resultado de uma operação feito na binarias, podemos estar utilizando o check_win_v3() ou o check_win_v4()\n\n\n###### check_win_v3()\n```python\nIq.check_win(23243221)\n#\"\"you need to get id_number from buy function\"\"\n#Iq.check_win(id_number)\n#this function will do loop check your bet until if win/equal/loose\n````\n\n##### check_win_v2\n\nAPI = IQ_Option(\"email\", \"password\")\n\nEntrada = 1\nParidade = \"EURUSD\"\nDirecao = \"call\"\nDuracao = 1\n\nid = API.buy(Entrada, Paridade, Direcao, Duracao)\n\ntime.sleep(5)\n\n```python\nIq.check_win_v2(23243221)\n#\"\"you need to get id_number from buy function\"\"\n#Iq.check_win_v2(id_number)\n#this function will do loop check your bet until if win/equal/loose\n```\n\n---\n\n\"get_binary_option_detail\" and \"get_all_profit\" are base on \"get_all_init()\",if you want raw data you can call\n\n```python\nIq.get_all_init()\n```\n\n---\n\n### Dados brutos da **BINÁRIA**\n\n#### get_all_init()\n\n\"get_binary_option_detail()\" e \"get_all_profit()\" são baseados no \"get_all_init()\", para retornar os dados \"brutos\", você pode utilizar:\n\nExemplo\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\n\nAPI = IQ_Option(\"email\", \"password\")\n\nprint(API.get_all_init())\n```\n\n![](image/expiration_time.png)\n\n#### get_binary_option_detail()\n\nsample\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nprint(\"login...\")\nIq=IQ_Option(\"email\",\"password\")\nd=Iq.get_binary_option_detail()\nprint(d[\"CADCHF\"][\"turbo\"])\nprint(d[\"CADCHF\"][\"binary\"])\n```\n\n#### get all profit\n\nsample\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nprint(\"login...\")\nIq=IQ_Option(\"email\",\"password\")\nd=Iq.get_all_profit()\nprint(d[\"CADCHF\"][\"turbo\"])\nprint(d[\"CADCHF\"][\"binary\"])\n```\n\n---\n\n#### get_betinfo\n\nTemos dois modos para fazer isto, para ambos precisamos indicar quantos 'trades' você quer retornar do histórico de trading ( apenas das binárias )\n\n###### get_optioninfo()\n\n```python\n\nisSuccessful,dict=Iq.get_betinfo(4452272449)\n#Iq.get_betinfo\n#INPUT: int\n#OUTPUT:isSuccessful,dict\n\nprint(API.get_optioninfo(10))\n```\n\n#### \u003ca id=optioninfo\u003eget_optioninfo\u003c/a\u003e\n\n###### get_optioninfo_v2()\n\n```\nprint(Iq.get_optioninfo(10))\n```\n\n#### \u003ca id=optioninfo\u003eget_optioninfo_v2\u003c/a\u003e\n\nAPI = IQ_Option(\"email\", \"password\")\n\nprint(API.get_optioninfo_v2(10))\n\n```\nprint(Iq.get_optioninfo_v2(10))\n```\n\n#### \u003ca id=getoptionopenbyotherpc\u003eget_option_open_by_other_pc\u003c/a\u003e\n\n#### Pegar opções feitas por outro dispositivo com get_option_open_by_other_pc()\n\nSe sua conta está logada em outro celular/PC e está realizando operações, você pode \"pegar\" a operação do modo abaixo\n\n```python\nimport time\nfrom iqoptionapi.stable_api import IQ_Option\nIq=IQ_Option(\"email\",\"password\")\nwhile True:\n    #please open website iqoption and buy some binary option\n    if Iq.get_option_open_by_other_pc()!={}:\n        break\n    time.sleep(1)\nprint(\"Get option from other Pc and same account\")\nprint(Iq.get_option_open_by_other_pc())\n\nid=list(Iq.get_option_open_by_other_pc().keys())[0]\nIq.del_option_open_by_other_pc(id)\nprint(\"After del by id\")\nprint(Iq.get_option_open_by_other_pc())\n```\n\n---\n\n---\n\n### \u003ca id=digital\u003eFor Digital\u003c/a\u003e\n\n[Digital options buy with actual price sample code](https://github.com/Lu-Yi-Hsun/iqoptionapi/issues/65#issuecomment-511660908)\n\n### Para digitais\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nimport time\nimport random\nIq=IQ_Option(\"email\",\"password\")\n\nACTIVES=\"EURUSD\"\nduration=1#minute 1 or 5\namount=1\nIq.subscribe_strike_list(ACTIVES,duration)\n#get strike_list\ndata=Iq.get_realtime_strike_list(ACTIVES, duration)\nprint(\"get strike data\")\nprint(data)\n\"\"\"data\n{'1.127100':\n    {  'call':\n            {   'profit': None,\n                'id': 'doEURUSD201811120649PT1MC11271'\n            },\n        'put':\n            {   'profit': 566.6666666666666,\n                'id': 'doEURUSD201811120649PT1MP11271'\n            }\n    }............\n}\n\"\"\"\n#get price list\nprice_list=list(data.keys())\n#random choose Strategy\nchoose_price=price_list[random.randint(0,len(price_list)-1)]\n#get instrument_id\ninstrument_id=data[choose_price][\"call\"][\"id\"]\n#get profit\nprofit=data[choose_price][\"call\"][\"profit\"]\nprint(\"choose you want to buy\")\nprint(\"price:\",choose_price,\"side:call\",\"instrument_id:\",instrument_id,\"profit:\",profit)\n#put instrument_id to buy\nbuy_check,id=Iq.buy_digital(amount,instrument_id)\nif buy_check:\n    print(\"wait for check win\")\n    #check win\n    while True:\n        check_close,win_money=Iq.check_win_digital_v2(id)\n        if check_close:\n            if float(win_money)\u003e0:\n                win_money=(\"%.2f\" % (win_money))\n                print(\"you win\",win_money,\"money\")\n            else:\n                print(\"you loose\")\n            break\n    Iq.unsubscribe_strike_list(ACTIVES,duration)\nelse:\n    print(\"fail to buy,please run again\")\n```\n\n#### \u003ca id=strikelist\u003eGet all strike list data\u003c/a\u003e\n\n#### get_all_strike_list_data()\n\nFormato da informação retornada\n\n{'1.127100': { 'call': {'profit': None, 'id': 'doEURUSD201811120649PT1MC11271'}, 'put': {'profit': 566.6666666666666, 'id': 'doEURUSD201811120649PT1MP11271'} }.......}\n\n````\n\nExemplo de uso\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nimport time\nIq=IQ_Option(\"email\",\"password\")\nACTIVES=\"EURUSD\"\nduration=1#minute 1 or 5\nIq.subscribe_strike_list(ACTIVES,duration)\nwhile True:\n    data=Iq.get_realtime_strike_list(ACTIVES, duration)\n    for price in data:\n        print(\"price\",price,data[price])\n    time.sleep(5)\nIq.unsubscribe_strike_list(ACTIVES,duration)\n````\n\n#### Realizar operações nas Digitais com buy_digital_spot()\n\nAbrir operação na digital com preço atual\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\n\nIq=IQ_Option(\"email\",\"password\")\n\nACTIVES=\"EURUSD\"\nduration=1#minute 1 or 5\namount=1\naction=\"call\"#put\nprint(Iq.buy_digital_spot(ACTIVES,amount,action,duration))\n```\n\n#### Pegar lucro pós venda com get_digital_spot_profit_after_sale()\n\n![](image/profit_after_sale.png)\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nIq=IQ_Option(\"email\",\"passord\")\nACTIVES=\"EURUSD\"\nduration=1#minute 1 or 5\namount=100\naction=\"put\"#put\n\nIq.subscribe_strike_list(ACTIVES,duration)\nid=Iq.buy_digital_spot(ACTIVES,amount,action,duration)\n\nwhile True:\n    PL=Iq.get_digital_spot_profit_after_sale(id)\n    if PL!=None:\n        print(PL)\n\n```\n\n#### \u003ca id=getdigitalcurrentprofit\u003eget_digital_current_profit\u003c/a\u003e\n\nget current price profit\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nimport time\nimport logging\n#logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')\nIq=IQ_Option(\"email\",\"password\")\nACTIVES=\"EURUSD\"\nduration=1#minute 1 or 5\nIq.subscribe_strike_list(ACTIVES,duration)\nwhile True:\n    data=Iq.get_digital_current_profit(ACTIVES, duration)\n    print(data)#from first print it may be get false,just wait a second you can get the profit\n    time.sleep(1)\nIq.unsubscribe_strike_list(ACTIVES,duration)\n```\n\n#### Buy digit\n\n```python\nbuy_check,id=Iq.buy_digital(amount,instrument_id)\n#get instrument_id from Iq.get_realtime_strike_list\n```\n\n#### check win for digital\n\n#### Verificar resultado da operação nas **DIGITAIS**\n\nthis api is implement by get_digital_position()\n\n###### check_win_digital()\n\nEsta função foi implementada com get_digital_position()\n\n```python\nIq.check_win_digital(id)#get the id from Iq.buy_digital\n#return:check_close,win_money\n#return sample\n#if you loose:Ture,o\n#if you win:True,1232.3\n#if trade not clode yet:False,None\n```\n\n##### \u003ca id=checkwindigitalv2\u003echeck_win_digital_v2\u003c/a\u003e\n\n:exclamation::exclamation: this api is asynchronous get id data,it only can get id data before you call the buy action. if you restart the program,the asynchronous id data can not get again,so check_win_digital_v2 may not working,so you need to use \"check_win_digital\"!\n\n```python\nIq.check_win_digital_v2(id)#get the id from Iq.buy_digital\n#return:check_close,win_money\n#return sample\n#if you loose:Ture,o\n#if you win:True,1232.3\n#if trade not clode yet:False,None\n```\n\nExemplo\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nimport logging\nimport random\nimport time\nimport datetime\n#logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')\nIq=IQ_Option(\"email\",\"password\")\n\nAPI = IQ_Option(\"email\", \"password\")\n\n\nParidade = \"EURUSD\"\nDuracao = 1 #1 ou 5 minutos\nEntrada = 1\nDirecao = \"call\"\n\nACTIVES=\"EURUSD\"\nduration=1#minute 1 or 5\namount=1\naction=\"call\"#put\nid=(Iq.buy_digital_spot(ACTIVES,amount,action,duration))\nprint(id)\n\nif id != \"error\":\n    while True:\n        check,win=Iq.check_win_digital_v2(id)\n        if check==True:\n            break\n    if lucro \u003c 0:\n        print(\"Voce perdeu \"+str(win)+\"$\")\n    else:\n        print(\"Voce ganhou \"+str(win)+\"$\")\nelse:\n    print(\"Por favor, tente novamente\")\n```\n\n#### close digital\n\n```python\nIq.close_digital_option(id)\n```\n\n#### get digital data\n\n#### Pegar informações das **DIGITAIS**\n\nUtilizando get_digital_position()\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nimport logging\nimport time\n#logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')\nIq=IQ_Option(\"email\",\"password\")\nACTIVES=\"EURUSD-OTC\"\nduration=1#minute 1 or 5\namount=1\naction=\"call\"#put\nfrom datetime import datetime\n\nid=Iq.buy_digital_spot(ACTIVES,amount,action,duration)\n\nwhile True:\n    check,_=Iq.check_win_digital(id)\n    if check:\n        break\nprint(Iq.get_digital_position(id))\nprint(Iq.check_win_digital(id))\n```\n\n#####sample 2\n\n```python\n#print(Iq.get_order(id))#not work for digital\nprint(Iq.get_positions(\"digital-option\"))\nprint(Iq.get_digital_position(2323433))#in put the id\nprint(Iq.get_position_history(\"digital-option\"))\n```\n\n---\n\n### \u003ca id=forex\u003eFor Forex\u0026Stock\u0026Commodities\u0026Crypto\u0026ETFs\u003c/a\u003e\n\n#### you need to check Asset is open or close!\n\ntry this api [get_all_open_time](#checkopen)\n![](image/asset_close.png)\n\n#### \u003ca id=instrumenttypeid\u003eAbout instrument_type and instrument_id\u003c/a\u003e\n\nyou can search instrument_type and instrument_id from this file\n\n[search instrument_type and instrument_id](instrument.txt)\n\n#### Sample\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nIq=IQ_Option(\"email\",\"password\")\n\ninstrument_type=\"crypto\"\ninstrument_id=\"BTCUSD\"\nside=\"buy\"#input:\"buy\"/\"sell\"\namount=1.23#input how many Amount you want to play\n\n#\"leverage\"=\"Multiplier\"\nleverage=3#you can get more information in get_available_leverages()\n\ntype=\"market\"#input:\"market\"/\"limit\"/\"stop\"\n\n#for type=\"limit\"/\"stop\"\n\n# only working by set type=\"limit\"\nlimit_price=None#input:None/value(float/int)\n\n# only working by set type=\"stop\"\nstop_price=None#input:None/value(float/int)\n\n#\"percent\"=Profit Percentage\n#\"price\"=Asset Price\n#\"diff\"=Profit in Money\n\nstop_lose_kind=\"percent\"#input:None/\"price\"/\"diff\"/\"percent\"\nstop_lose_value=95#input:None/value(float/int)\n\ntake_profit_kind=None#input:None/\"price\"/\"diff\"/\"percent\"\ntake_profit_value=None#input:None/value(float/int)\n\n#\"use_trail_stop\"=\"Trailing Stop\"\nuse_trail_stop=True#True/False\n\n#\"auto_margin_call\"=\"Use Balance to Keep Position Open\"\nauto_margin_call=False#True/False\n#if you want \"take_profit_kind\"\u0026\n#            \"take_profit_value\"\u0026\n#            \"stop_lose_kind\"\u0026\n#            \"stop_lose_value\" all being \"Not Set\",\"auto_margin_call\" need to set:True\n\nuse_token_for_commission=False#True/False\n\ncheck,order_id=Iq.buy_order(instrument_type=instrument_type, instrument_id=instrument_id,\n            side=side, amount=amount,leverage=leverage,\n            type=type,limit_price=limit_price, stop_price=stop_price,\n            stop_lose_value=stop_lose_value, stop_lose_kind=stop_lose_kind,\n            take_profit_value=take_profit_value, take_profit_kind=take_profit_kind,\n            use_trail_stop=use_trail_stop, auto_margin_call=auto_margin_call,\n            use_token_for_commission=use_token_for_commission)\nprint(Iq.get_order(order_id))\nprint(Iq.get_positions(\"crypto\"))\nprint(Iq.get_position_history(\"crypto\"))\nprint(Iq.get_available_leverages(\"crypto\",\"BTCUSD\"))\nprint(Iq.close_position(order_id))\nprint(Iq.get_overnight_fee(\"crypto\",\"BTCUSD\"))\n```\n\n#### Buy\n\nreturn (True/False,buy_order_id/False)\n\nif Buy sucess return (True,buy_order_id)\n\n\"percent\"=Profit Percentage\n\n\"price\"=Asset Price\n\n\"diff\"=Profit in Money\n\n| parameter                |                                      |                                                   |        |           |\n| ------------------------ | ------------------------------------ | ------------------------------------------------- | ------ | --------- |\n| instrument_type          | [instrument_type](#instrumenttypeid) |\n| instrument_id            | [instrument_id](#instrumenttypeid)   |\n| side                     | \"buy\"                                | \"sell\"                                            |\n| amount                   | value(float/int)                     |\n| leverage                 | value(int)                           |\n| type                     | \"market\"                             | \"limit\"                                           | \"stop\" |\n| limit_price              | None                                 | value(float/int):Only working by set type=\"limit\" |\n| stop_price               | None                                 | value(float/int):Only working by set type=\"stop\"  |\n| stop_lose_kind           | None                                 | \"price\"                                           | \"diff\" | \"percent\" |\n| stop_lose_value          | None                                 | value(float/int)                                  |\n| take_profit_kind         | None                                 | \"price\"                                           | \"diff\" | \"percent\" |\n| take_profit_value        | None                                 | value(float/int)                                  |\n| use_trail_stop           | True                                 | False                                             |\n| auto_margin_call         | True                                 | False                                             |\n| use_token_for_commission | True                                 | False                                             |\n\n```python\ncheck,order_id=Iq.buy_order(\n            instrument_type=instrument_type, instrument_id=instrument_id,\n            side=side, amount=amount,leverage=leverage,\n            type=type,limit_price=limit_price, stop_price=stop_price,\n            stop_lose_kind=stop_lose_kind,\n            stop_lose_value=stop_lose_value,\n            take_profit_kind=take_profit_kind,\n            take_profit_value=take_profit_value,\n            use_trail_stop=use_trail_stop, auto_margin_call=auto_margin_call,\n            use_token_for_commission=use_token_for_commission)\n\n```\n\n#### \u003ca id=changeorder\u003echange_order\u003c/a\u003e\n\n##### change PENDING\n\n![](image/change_ID_Name_order_id.png)\n\n##### change Position\n\n![](image/change_ID_Name_position_id.png)\n\n| parameter         |                                             |                  |        |           |\n| ----------------- | ------------------------------------------- | ---------------- | ------ | --------- |\n| ID_Name           | \"position_id\"                               | \"order_id\"       |\n| order_id          | \"you need to get order_id from buy_order()\" |\n| stop_lose_kind    | None                                        | \"price\"          | \"diff\" | \"percent\" |\n| stop_lose_value   | None                                        | value(float/int) |\n| take_profit_kind  | None                                        | \"price\"          | \"diff\" | \"percent\" |\n| take_profit_value | None                                        | value(float/int) |\n| use_trail_stop    | True                                        | False            |\n| auto_margin_call  | True                                        | False            |\n\n##### sample\n\n```python\nID_Name=\"order_id\"#\"position_id\"/\"order_id\"\nstop_lose_kind=None\nstop_lose_value=None\ntake_profit_kind=\"percent\"\ntake_profit_value=200\nuse_trail_stop=False\nauto_margin_call=True\nIq.change_order(ID_Name=ID_Name,order_id=order_id,\n                stop_lose_kind=stop_lose_kind,stop_lose_value=stop_lose_value,\n                take_profit_kind=take_profit_kind,take_profit_value=take_profit_value,\n                use_trail_stop=use_trail_stop,auto_margin_call=auto_margin_call)\n```\n\n---\n\n#### get_order\n\nget infomation about buy_order_id\n\nreturn (True/False,get_order,None)\n\n```python\nIq.get_order(buy_order_id)\n```\n\n#### get_pending\n\nyou will get there data\n\n![](image/get_pending.png)\n\n```python\nIq.get_pending(instrument_type)\n```\n\n#### get_positions\n\nyou will get there data\n\n![](image/get_positions.png)\n\nreturn (True/False,get_positions,None)\n\n:exclamation: not support \"\"turbo-option\"\"\n\ninstrument_type=\"crypto\",\"forex\",\"fx-option\",\"multi-option\",\"cfd\",\"digital-option\"\n\n```python\nIq.get_positions(instrument_type)\n```\n\n#### get_position\n\nyou will get there data\n\n![](image/get_position.png)\n\nyou will get one position by buy_order_id\n\nreturn (True/False,position data,None)\n\n```python\nIq.get_positions(buy_order_id)\n```\n\n#### get_position_history\n\nyou will get there data\n\n![](image/get_position_history.png)\n\nreturn (True/False,position_history,None)\n\n```python\nIq.get_position_history(instrument_type)\n```\n\n#### \u003ca id=getpositionhistoryv2\u003eget_position_history_v2\u003c/a\u003e\n\ninstrument_type=\"crypto\",\"forex\",\"fx-option\",\"turbo-option\",\"multi-option\",\"cfd\",\"digital-option\"\n\nget_position_history_v2(instrument_type,limit,offset,start,end)\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nimport logging\nimport random\nimport time\nimport datetime\nlogging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')\nIq=IQ_Option(\"email\",\"password\")\n\n#instrument_type=\"crypto\",\"forex\",\"fx-option\",\"turbo-option\",\"multi-option\",\"cfd\",\"digital-option\"\ninstrument_type=\"digital-option\"\nlimit=2#How many you want to get\noffset=0#offset from end time,if end time is 0,it mean get the data from now\nstart=0#start time Timestamp\nend=0#Timestamp\ndata=Iq.get_position_history_v2(instrument_type,limit,offset,start,end)\n\nprint(data)\n\n#--------- this will get data start from 2019/7/1(end) to 2019/1/1(start) and only get 2(limit) data and offset is 0\ninstrument_type=\"digital-option\"\nlimit=2#How many you want to get\noffset=0#offset from end time,if end time is 0,it mean get the data from now\nstart=int(time.mktime(datetime.datetime.strptime(\"2019/1/1\", \"%Y/%m/%d\").timetuple()))\nend=int(time.mktime(datetime.datetime.strptime(\"2019/7/1\", \"%Y/%m/%d\").timetuple()))\ndata=Iq.get_position_history_v2(instrument_type,limit,offset,start,end)\nprint(data)\n\n```\n\n#### get_available_leverages\n\nget available leverages\n\nreturn (True/False,available_leverages,None)\n\n```python\nIq.get_available_leverages(instrument_type,actives)\n```\n\n#### cancel_order\n\nyou will do this\n\n![](image/cancel_order.png)\n\nreturn (True/False)\n\n```python\nIq.cancel_order(buy_order_id)\n```\n\n#### close_position\n\nyou will do this\n\n![](image/close_position.png)\n\nreturn (True/False)\n\n```python\nIq.close_position(buy_order_id)\n```\n\n#### get_overnight_fee\n\nreturn (True/False,overnight_fee,None)\n\n```python\nIq.get_overnight_fee(instrument_type,active)\n```\n\n---\n\n---\n\n### Candle\n\n#### get candles\n\n:exclamation:\n\nget_candles can not get \"real time data\" ,it will late about 30sec\n\nif you very care about real time you need use\n\n\"get realtime candles\" OR \"collect realtime candles\"\n\nsample\n\n\"\"now\"\" time 1:30:45sec\n\n1.  you want to get candles 1:30:45sec now\n\n    you may get 1:30:15sec data have been late approximately 30sec\n\n2.  you want to get candles 1:00:33sec\n\n    you will get the right data\n\n```python\nIq.get_candles(ACTIVES,interval,count,endtime)\n            #ACTIVES:sample input \"EURUSD\" OR \"EURGBP\".... youcan\n            #interval:duration of candles\n            #count:how many candles you want to get from now to past\n            #endtime:get candles from past to \"endtime\"\n```\n\n:exclamation:\ntry this code to get more than 1000 candle\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nimport time\nIq=IQ_Option(\"email\",\"password\")\nend_from_time=time.time()\nANS=[]\nfor i in range(70):\n    data=Iq.get_candles(\"EURUSD\", 60, 1000, end_from_time)\n    ANS =data+ANS\n    end_from_time=int(data[0][\"from\"])-1\nprint(ANS)\n```\n\n#### get realtime candles\n\n##### Sample\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nimport logging\nimport time\n#logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')\nprint(\"login...\")\nIq=IQ_Option(\"email\",\"password\")\ngoal=\"EURUSD\"\nsize=\"all\"#size=[1,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,28800,43200,86400,604800,2592000,\"all\"]\nmaxdict=10\nprint(\"start stream...\")\nIq.start_candles_stream(goal,size,maxdict)\n#DO something\nprint(\"Do something...\")\ntime.sleep(10)\n\nprint(\"print candles\")\ncc=Iq.get_realtime_candles(goal,size)\nfor k in cc:\n    print(goal,\"size\",k,cc[k])\nprint(\"stop candle\")\nIq.stop_candles_stream(goal,size)\n```\n\n##### start_candles_stream\n\n- input:\n  - goal:\"EURUSD\"...\n  - size:[1,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,28800,43200,86400,604800,2592000,\"all\"]\n  - maxdict:set max buffer you want to save\n\nsize\n\n![](image/time_interval.png)\n\n##### get_realtime_candles\n\n- input:\n  - goal:\"EURUSD\"...\n  - size:[1,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,28800,43200,86400,604800,2592000,\"all\"]\n- output:\n  - dict\n\n##### stop_candles_stream\n\n- input:\n  - goal:\"EURUSD\"...\n  - size:[1,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,28800,43200,86400,604800,2592000,\"all\"]\n\n---\n\n### time\n\n#### \u003ca id=timestamp\u003e get_server_timestamp\u003c/a\u003e\n\nthe get_server_timestamp time is sync with iqoption\n\n```python\nIq.get_server_timestamp()\n```\n\n#### \u003ca id=purchase\u003ePurchase Time\u003c/a\u003e\n\nthis sample get the Purchase time clock\n\n```python\nimport time\n\n#get the end of the timestamp by expiration time\ndef get_expiration_time(t):\n    exp=time.time()#or Iq.get_server_timestamp() to get more Precision\n    if (exp % 60) \u003e 30:\n        end = exp - (exp % 60) + 60*(t+1)\n    else:\n        end = exp - (exp % 60)+60*(t)\n    return end\n\nexpiration_time=2\n\nend_time=0\nwhile True:\n    if end_time-time.time()-30\u003c=0:\n        end_time = get_expiration_time(expiration_time)\n    print(end_time-time.time()-30)\n    time.sleep(1)\n```\n\n---\n\n### Get top_assets_updated\n\ninstrument_type=\"binary-option\"/\"digital-option\"/\"forex\"/\"cfd\"/\"crypto\"\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nimport logging\nimport time\n#logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')\nIq=IQ_Option(\"email\",\"password\")\ninstrument_type=\"digital-option\"#\"binary-option\"/\"digital-option\"/\"forex\"/\"cfd\"/\"crypto\"\nIq.subscribe_top_assets_updated(instrument_type)\n\nprint(\"__Please_wait_for_sec__\")\nwhile True:\n    if Iq.get_top_assets_updated(instrument_type)!=None:\n        print(Iq.get_top_assets_updated(instrument_type))\n        print(\"\\n\\n\")\n    time.sleep(1)\nIq.unsubscribe_top_assets_updated(instrument_type)\n```\n\n#### get popularity by top_assets_updated() api\n\nhttps://github.com/Lu-Yi-Hsun/iqoptionapi/issues/131\n\n![](https://user-images.githubusercontent.com/7738916/66943816-c9ee1380-f000-11e9-996e-e06efba64101.png)\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nimport logging\nimport time\nimport operator\n\n#logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')\ndef opcode_to_name(opcode_data,opcode):\n    return list(opcode_data.keys())[list(opcode_data.values()).index(opcode)]\n\nIq=IQ_Option(\"email\",\"password\")\nIq.update_ACTIVES_OPCODE()\nopcode_data=Iq.get_all_ACTIVES_OPCODE()\n\ninstrument_type=\"digital-option\"#\"binary-option\"/\"digital-option\"/\"forex\"/\"cfd\"/\"crypto\"\nIq.subscribe_top_assets_updated(instrument_type)\n\n\nprint(\"__Please_wait_for_sec__\")\nwhile True:\n    if Iq.get_top_assets_updated(instrument_type)!=None:\n        break\n\ntop_assets=Iq.get_top_assets_updated(instrument_type)\npopularity={}\nfor asset in top_assets:\n    opcode=asset[\"active_id\"]\n    popularity_value=asset[\"popularity\"][\"value\"]\n    try:\n        name=opcode_to_name(opcode_data,opcode)\n        popularity[name]=popularity_value\n    except:\n        pass\n\n\nsorted_popularity = sorted(popularity.items(), key=operator.itemgetter(1))\nprint(\"__Popularity_min_to_max__\")\nfor lis in sorted_popularity:\n    print(lis)\n\nIq.unsubscribe_top_assets_updated(instrument_type)\n```\n\n---\n\n### Get mood\n\nfor now... only support get binary option mood , i will implement beterr if need..\n\nSample\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nIq=IQ_Option(\"email\",\"password\")\ngoal=\"EURUSD\"\ninstrument=\"forex\" ## Option \"forex\", \"turbo-option\"\nIq.start_mood_stream(goal, instrument)\nprint(Iq.get_traders_mood(goal))\nIq.stop_mood_stream(goal)\n```\n\nit returns example:\n0.4233422\n\nitem means 42 % call/buy\n\n#### get_traders_mood\n\nget percent of higher(call)\n\nif you want to know percent of lower(put) just 1-higher\n\n```python\nIq.get_traders_mood(goal)\n#input:input \"EURUSD\" OR \"EURGBP\".... you can view by get_all_ACTIVES_OPCODE\n#output:(float) the higher(call)%\n#if you want to know lower(put)% try 1-Iq.get_traders_mood(goal)\n```\n\n#### get_all_traders_mood\n\nget all you start mood\n\n```python\nIq.get_all_traders_mood(goal)\n#output:(dict) all mood you start\n```\n\n\u003cdiv id='technicalindicators'/\u003e\n\n#### How to Get Technical indicators\n\nIt get technical indicator from any asset cointains it\n\n```python\n## api auth then\nasset=\"GBPUSD\"\nindicators = Iq.get_technical_indicators(asset)\nprint(indicators)\n\n```\n\nif assets doesn't contains technical indicator it returns:\n\n```json\n{\n  \"code\": \"no_technical_indicator_available\",\n  \"message\": \"Active is not supported: active id 'ACTIVE_ID_PASSED'\"\n}\n```\n\n### Account\n\n#### get balance\n\n```python\nIq.get_balance()\n```\n\n#### \u003ca id=resetpracticebalance\u003ereset practice balance\u003c/a\u003e\n\nreset practice balance to \\$10000\n\n```python\nfrom iqoptionapi.stable_api import IQ_Option\nIq=IQ_Option(\"email\",\"password\")\nprint(Iq.reset_practice_balance())\n```\n\n#### Change real/practice Account\n\n```python\nIq.change_balance(MODE)\n                        #MODE: \"PRACTICE\"/\"REAL\"\n```\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiqoptionapi%2Fiqoptionapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiqoptionapi%2Fiqoptionapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiqoptionapi%2Fiqoptionapi/lists"}