Beginner
0
All posts from Beginner
  Beginner in Poyarkov696,

Моя первая программа на Qpile. Расчет точки безубыточности для сделки.

PORTFOLIO_EX Spreads;
DESCRIPTION Spreads;
CLIENTS_LIST ALL_CLIENTS;
FIRMS_LIST FIRMID;

PROGRAM

'Автор: Beginner
' электронная почта: svar4ikov@yandex.ru
'Что делает:
' Рассчитывает точку безубыточности для одной акции из списка
' (Газпром, Лукойл, ГМКникель,Роснефть,СберБанк, ВТБ, Сургут и др.)
' всего 20 наиболее ликвидных акции на площадке ММВБ.

DELETE_ALL_ITEMS()
Br_tarif=0.00045 ' комиссия брокера (устанавливаете свою коммисию)
Kom_Micex=0.0001 ' комиссия биржы ММВБ
NDS=0.18 ' НДС

 Pr_kom=Br_tarif*(1+NDS)+Kom_Micex ' общая комиссия

OutPutPrice = CREATE_MAP()

'======================= ВТБ =========================
LPrice=GET_PARAM("EQNL","VTBR","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQNL","VTBR","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (1, OutPutPrice)
'================================================

'======================= ГПнефть =========================
LPrice=GET_PARAM("EQNE","SIBN","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQNE","SIBN","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (2, OutPutPrice)
'================================================

'======================= Газпром =========================
LPrice=GET_PARAM("EQNE","GAZP","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQNE","GAZP","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (3, OutPutPrice)
'================================================

'======================= Гамак =========================
LPrice=GET_PARAM("EQBR","GMKN","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQBR","GMKN","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (4, OutPutPrice)
'================================================

'================ Лук ===============================
LPrice=GET_PARAM("EQBR","LKOH","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQBR","LKOH","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (5, OutPutPrice)
'=====================================================

'======================= MMK =========================
LPrice=GET_PARAM("EQNL","MAGN","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQNL","MAGN","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (6, OutPutPrice)
'================================================

'======================= MTC =========================
LPrice=GET_PARAM("EQBR","MTSI","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQBR","MTSI","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (7, OutPutPrice)
'================================================

'======================= НЛМК =========================
LPrice=GET_PARAM("EQNL","NLMK","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQNL","NLMK","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (8, OutPutPrice)
'================================================

'======================= Новатек =========================
LPrice=GET_PARAM("EQBR","NOTK","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQBR","NOTK","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (9, OutPutPrice)
'================================================

'======================= Полюс =========================
LPrice=GET_PARAM("EQNL","PLZL","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQNL","PLZL","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (10, OutPutPrice)
'================================================

'======================= Роснефть =========================
LPrice=GET_PARAM("EQNL","ROSN","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQNL","ROSN","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (11, OutPutPrice)
'================================================

'===================== Ростелеком преф.===========================
LPrice=GET_PARAM("EQBR","RTKMP","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQBR","RTKMP","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (12, OutPutPrice)
'================================================

'======================= Гидра =========================
LPrice=GET_PARAM("EQBR","HYDR","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQBR","HYDR","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (13, OutPutPrice)
'================================================

'===================== Сбер ===========================
LPrice=GET_PARAM("EQBR","SBER03","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQBR","SBER03","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (14, OutPutPrice)
'================================================


'===================== Сбер преф. ===========================
LPrice=GET_PARAM("EQBR","SBERP03","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQBR","SBERP03","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (15, OutPutPrice)
'================================================

'======================= СевСт =========================
LPrice=GET_PARAM("EQNL","CHMF","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQNL","CHMF","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (16, OutPutPrice)
'================================================

'======================= Сургут =========================
LPrice=GET_PARAM("EQNE","SNGS","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQNE","SNGS","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (17, OutPutPrice)
'================================================

'======================= Сургут преф. =========================
LPrice=GET_PARAM("EQNE","SNGSP","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQNE","SNGSP","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (18, OutPutPrice)
'================================================

'======================= Урси =========================
LPrice=GET_PARAM("EQBR","URSI","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQBR","URSI","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (19, OutPutPrice)
'================================================

'======================= Урка =========================
LPrice=GET_PARAM("EQNL","URKA","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQNL","URKA","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (20, OutPutPrice)
'================================================

'======================= ФЭС СК =========================
LPrice=GET_PARAM("EQNL","FEES","LAST")
Spreads=2*LPrice*Pr_kom
Sum=LPrice+Spreads
NameTick=GET_VALUE(GET_PARAM_EX("EQNL","FEES","SHORTNAME"), "PARAM_IMAGE")

OutPutPrice = SET_VALUE (OutPutPrice, "NameTick", NameTick)
OutPutPrice = SET_VALUE (OutPutPrice, "LPrice", LPrice)
OutPutPrice = SET_VALUE (OutPutPrice, "Spreads", Spreads)
OutPutPrice = SET_VALUE (OutPutPrice, "Sum", Sum)
ADD_ITEM (21, OutPutPrice)
'================================================

END_PROGRAM

PARAMETER NameTick;
PARAMETER_TITLE Акция;
PARAMETER_DESCRIPTION NameTick;
PARAMETER_TYPE STRING(255);
END

PARAMETER LPrice;
PARAMETER_TITLE Послед. цена;
PARAMETER_DESCRIPTION Value_RIM9;
PARAMETER_TYPE NUMERIC(10,3);
END

PARAMETER Spreads;
PARAMETER_TITLE Точка безубыт.;
PARAMETER_DESCRIPTION Value;
PARAMETER_TYPE NUMERIC(10,5);
END

PARAMETER Sum;
PARAMETER_TITLE Цена безубыт.;
PARAMETER_DESCRIPTION Value;
PARAMETER_TYPE NUMERIC(10,5);
END

END_PORTFOLIO_EX