Comments (10)
make_external_latex<-function(
latex="testing123",
filename=NULL
)paste0(
if(!is.null(filename)){paste0("\\tikzsetnextfilename{",filename,"}"," ")}else{""},
"\\tikz{\\path (0,0) node[inner sep=0,outer sep=0]{",
latex,
"};}"
)
from pairs.
for pair icons, we have a function that paints the icon ofr a pair using tikz
pair_icon<-function(
pair,
pair_exposure,
pair_days,
pair_pnl,
pair_long_pnl,
pair_short_pnl,
drop_one_pair_pnl,
local_pnl
){
icon_items<-c(
paste0("\\multicolumn{1}{@{}c@{}}{",pair_with_pm_color(pair=pair),"}"),
paste0("\\multicolumn{1}{@{}c@{}}{",pair_price_action(pair=pair,pair_pnl=pair_pnl,w=21,height=2,width = 30,units="mm"),"}"),
paste0("\\multicolumn{1}{@{}c@{}}{",pair_technicals(
pair=pair,
w=365,
pair_exposure=pair_exposure,
pair_days=pair_days,
pair_long_pnl=pair_long_pnl,
pair_short_pnl=pair_short_pnl,
drop_one_pair_pnl=drop_one_pair_pnl,
local_pnl=local_pnl
),"}"),
pair_leg(pair=pair,pair_exposure=pair_exposure,direction=(1),max_char=12),
pair_leg(pair=pair,pair_exposure=pair_exposure,direction=(-1),max_char=12)
)
tbl(x=icon_items,sep=" \\\\ \n",align="@{}p{3.0cm}@{}")
}
from pairs.
and we loop over pair icons like this:
latex_icons<-mapply(pair_icon,pair=pairs,MoreArgs=list(
pair_exposure=pair_exposure,
pair_days=pair_days,
pair_pnl=pair_local_pnl,
pair_long_pnl=pair_long_pnl,
pair_short_pnl=pair_short_pnl,
drop_one_pair_pnl=drop_one_pair_pnl,
local_pnl=local_pnl
),SIMPLIFY = FALSE)
append2log("create_pair_icons.Rnw : create external latex commands")
external_latex_icons<-mapply(
function(latex,file){
make_external_latex(latex=latex,filename=file)
},
latex=latex_icons,
#file=paste0("N:/Depts/Share/UK Alpha Team/Analytics/pair_icons/",pairs),
file=paste0(pairs),
SIMPLIFY=TRUE
)
from pairs.
and finally, we put the latex generated above into the doc:
\Sexpr{paste(external_latex_icons,collapse="\n")}
from pairs.
the output looks like this:
for example, pair ABC1
\tikzsetnextfilename{ABC1} \tikz{\path (0,0) node[inner sep=0,outer sep=0]{\begin{tabular}{@{}p{3.0cm}@{}} \multicolumn{1}{@{}c@{}}{\cellcolor{ABC!33}ABC1} \\
\multicolumn{1}{@{}c@{}}{\tikz{
\path
( 0.0mm,0mm)node[shape=regular polygon, regular polygon sides=3,rotate=180,fill=red,inner sep=0.25mm,minimum height=2mm]{}
( 1.5mm,0mm)node[shape=regular polygon, regular polygon sides=3,rotate=180,fill=red,inner sep=0.25mm,minimum height=2mm]{}
( 3.0mm,0mm)node[shape=cross out,draw=black,line width=0.125mm,inner sep=0.25mm,minimum height=1mm]{}
( 4.5mm,0mm)node[shape=cross out,draw=black,line width=0.125mm,inner sep=0.25mm,minimum height=1mm]{}
( 6.0mm,0mm)node[shape=regular polygon, regular polygon sides=3,rotate=180,fill=red,inner sep=0.25mm,minimum height=2mm]{}
( 7.5mm,0mm)node[shape=regular polygon, regular polygon sides=3,rotate=180,fill=red,inner sep=0.25mm,minimum height=2mm]{}
( 9.0mm,0mm)node[shape=regular polygon, regular polygon sides=3,rotate=180,fill=red,inner sep=0.25mm,minimum height=2mm]{}
(10.5mm,0mm)node[shape=regular polygon, regular polygon sides=3,fill=green,inner sep=0.25mm,minimum height=2mm]{}
(12.0mm,0mm)node[shape=regular polygon, regular polygon sides=3,fill=green,inner sep=0.25mm,minimum height=2mm]{}
(13.5mm,0mm)node[shape=cross out,draw=black,line width=0.125mm,inner sep=0.25mm,minimum height=1mm]{}
(15.0mm,0mm)node[shape=cross out,draw=black,line width=0.125mm,inner sep=0.25mm,minimum height=1mm]{}
(16.5mm,0mm)node[shape=regular polygon, regular polygon sides=3,fill=green,inner sep=0.25mm,minimum height=2mm]{}
(18.0mm,0mm)node[shape=regular polygon, regular polygon sides=3,fill=green,inner sep=0.25mm,minimum height=2mm]{}
(19.5mm,0mm)node[shape=regular polygon, regular polygon sides=3,rotate=180,fill=red,inner sep=0.25mm,minimum height=2mm]{}
(21.0mm,0mm)node[shape=regular polygon, regular polygon sides=3,fill=green,inner sep=0.25mm,minimum height=2mm]{}
(22.5mm,0mm)node[shape=regular polygon, regular polygon sides=3,rotate=180,fill=red,inner sep=0.25mm,minimum height=2mm]{}
(24.0mm,0mm)node[shape=cross out,draw=black,line width=0.125mm,inner sep=0.25mm,minimum height=1mm]{}
(25.5mm,0mm)node[shape=cross out,draw=black,line width=0.125mm,inner sep=0.25mm,minimum height=1mm]{}
(27.0mm,0mm)node[shape=regular polygon, regular polygon sides=3,rotate=180,fill=red,inner sep=0.25mm,minimum height=2mm]{}
(28.5mm,0mm)node[shape=regular polygon, regular polygon sides=3,rotate=180,fill=red,inner sep=0.25mm,minimum height=2mm]{}
(30.0mm,0mm)node[shape=cross out,draw=black,line width=0.125mm,inner sep=0.25mm,minimum height=1mm]{}
;}} \\
\multicolumn{1}{@{}c@{}}{\begin{tabular}{@{}l@{\hskip 1pt}l@{\hskip 1pt}l@{}}v0.4 & r3.5 & g164\\{\small\sfrac{RSI}{3m}:56} & {\small\sfrac{RSI}{1m}:55} & {\small\sfrac{RSI}{2w}:53} \\ {\small12m:84} & {\small6m:70} & {\small1m:73} \\ \fbox{\tikz{\fill[green] (8mm,2mm) circle(0.5mm);\fill[red] (0mm,0mm) circle(0.5mm);\draw[line width=0.2mm, inner sep=0pt, outer sep=0pt] (0.0000mm,0.0000mm)--(0.4211mm,0.0469mm)--(0.8421mm,0.1027mm)--(1.2632mm,0.1755mm)--(1.6842mm,0.2334mm)--(2.1053mm,0.3205mm)--(2.5263mm,0.4554mm)--(2.9474mm,0.6254mm)--(3.3684mm,0.8074mm)--(3.7895mm,0.9406mm)--(4.2105mm,1.1091mm)--(4.6316mm,1.2278mm)--(5.0526mm,1.3938mm)--(5.4737mm,1.5400mm)--(5.8947mm,1.6818mm)--(6.3158mm,1.8039mm)--(6.7368mm,1.9513mm)--(7.1579mm,1.9497mm)--(7.5789mm,1.9830mm)--(8.0000mm,2.0000mm);}}&\fbox{\tikz{\fill[green] (5.8947mm,2mm) circle(0.5mm);\fill[red] (0mm,0mm) circle(0.5mm);\draw[line width=0.2mm, inner sep=0pt, outer sep=0pt] (0.0000mm,0.0000mm)--(0.4211mm,0.1384mm)--(0.8421mm,0.3157mm)--(1.2632mm,0.4921mm)--(1.6842mm,0.7207mm)--(2.1053mm,1.0270mm)--(2.5263mm,1.2441mm)--(2.9474mm,1.3247mm)--(3.3684mm,1.4566mm)--(3.7895mm,1.5056mm)--(4.2105mm,1.4962mm)--(4.6316mm,1.5259mm)--(5.0526mm,1.7921mm)--(5.4737mm,1.9330mm)--(5.8947mm,2.0000mm)--(6.3158mm,1.9547mm)--(6.7368mm,1.9089mm)--(7.1579mm,1.7514mm)--(7.5789mm,1.6204mm)--(8.0000mm,1.6426mm);}}&\fbox{\tikz{\fill[green] (7.5789mm,2mm) circle(0.5mm);\fill[red] (3.7895mm,0mm) circle(0.5mm);\draw[line width=0.2mm, inner sep=0pt, outer sep=0pt] (0.0000mm,1.1246mm)--(0.4211mm,1.3526mm)--(0.8421mm,1.3573mm)--(1.2632mm,1.2882mm)--(1.6842mm,1.0196mm)--(2.1053mm,0.8503mm)--(2.5263mm,0.6810mm)--(2.9474mm,0.4571mm)--(3.3684mm,0.0453mm)--(3.7895mm,0.0000mm)--(4.2105mm,0.1255mm)--(4.6316mm,0.2511mm)--(5.0526mm,0.5246mm)--(5.4737mm,0.8688mm)--(5.8947mm,1.2140mm)--(6.3158mm,1.5142mm)--(6.7368mm,1.7688mm)--(7.1579mm,1.8961mm)--(7.5789mm,2.0000mm)--(8.0000mm,1.8610mm);}}\\\end{tabular}} \\
{\small DSM } \\
{\small KYG-SX4E }\\ \end{tabular}};}
from pairs.
and another one:
\tikzsetnextfilename{ABC11} \tikz{\path (0,0) node[inner sep=0,outer sep=0]{\begin{tabular}{@{}p{3.0cm}@{}} \multicolumn{1}{@{}c@{}}{\cellcolor{ABC!33}ABC11} \\
\multicolumn{1}{@{}c@{}}{\tikz{
\path
( 0.0mm,0mm)node[shape=regular polygon, regular polygon sides=3,fill=green,inner sep=0.25mm,minimum height=2mm]{}
( 1.5mm,0mm)node[shape=regular polygon, regular polygon sides=3,fill=green,inner sep=0.25mm,minimum height=2mm]{}
( 3.0mm,0mm)node[shape=cross out,draw=black,line width=0.125mm,inner sep=0.25mm,minimum height=1mm]{}
( 4.5mm,0mm)node[shape=cross out,draw=black,line width=0.125mm,inner sep=0.25mm,minimum height=1mm]{}
( 6.0mm,0mm)node[shape=regular polygon, regular polygon sides=3,fill=green,inner sep=0.25mm,minimum height=2mm]{}
( 7.5mm,0mm)node[shape=regular polygon, regular polygon sides=3,rotate=180,fill=red,inner sep=0.25mm,minimum height=2mm]{}
( 9.0mm,0mm)node[shape=regular polygon, regular polygon sides=3,fill=green,inner sep=0.25mm,minimum height=2mm]{}
(10.5mm,0mm)node[shape=regular polygon, regular polygon sides=3,fill=green,inner sep=0.25mm,minimum height=2mm]{}
(12.0mm,0mm)node[shape=regular polygon, regular polygon sides=3,rotate=180,fill=red,inner sep=0.25mm,minimum height=2mm]{}
(13.5mm,0mm)node[shape=cross out,draw=black,line width=0.125mm,inner sep=0.25mm,minimum height=1mm]{}
(15.0mm,0mm)node[shape=cross out,draw=black,line width=0.125mm,inner sep=0.25mm,minimum height=1mm]{}
(16.5mm,0mm)node[shape=regular polygon, regular polygon sides=3,fill=green,inner sep=0.25mm,minimum height=2mm]{}
(18.0mm,0mm)node[shape=regular polygon, regular polygon sides=3,fill=green,inner sep=0.25mm,minimum height=2mm]{}
(19.5mm,0mm)node[shape=regular polygon, regular polygon sides=3,rotate=180,fill=red,inner sep=0.25mm,minimum height=2mm]{}
(21.0mm,0mm)node[shape=regular polygon, regular polygon sides=3,rotate=180,fill=red,inner sep=0.25mm,minimum height=2mm]{}
(22.5mm,0mm)node[shape=regular polygon, regular polygon sides=3,rotate=180,fill=red,inner sep=0.25mm,minimum height=2mm]{}
(24.0mm,0mm)node[shape=cross out,draw=black,line width=0.125mm,inner sep=0.25mm,minimum height=1mm]{}
(25.5mm,0mm)node[shape=cross out,draw=black,line width=0.125mm,inner sep=0.25mm,minimum height=1mm]{}
(27.0mm,0mm)node[shape=regular polygon, regular polygon sides=3,fill=green,inner sep=0.25mm,minimum height=2mm]{}
(28.5mm,0mm)node[shape=regular polygon, regular polygon sides=3,fill=green,inner sep=0.25mm,minimum height=2mm]{}
(30.0mm,0mm)node[shape=cross out,draw=black,line width=0.125mm,inner sep=0.25mm,minimum height=1mm]{}
;}} \\
\multicolumn{1}{@{}c@{}}{\begin{tabular}{@{}l@{\hskip 1pt}l@{\hskip 1pt}l@{}}v0.2 & r(-13) & g153\\{\small\sfrac{RSI}{3m}:53} & {\small\sfrac{RSI}{1m}:55} & {\small\sfrac{RSI}{2w}:63} \\ {\small12m:98} & {\small6m:96} & {\small1m:93} \\ \fbox{\tikz{\fill[green] (5.4737mm,2mm) circle(0.5mm);\fill[red] (0mm,0mm) circle(0.5mm);\draw[line width=0.2mm, inner sep=0pt, outer sep=0pt] (0.0000mm,0.0000mm)--(0.4211mm,0.1280mm)--(0.8421mm,0.1769mm)--(1.2632mm,0.2794mm)--(1.6842mm,0.3225mm)--(2.1053mm,0.4585mm)--(2.5263mm,0.6763mm)--(2.9474mm,1.0189mm)--(3.3684mm,1.3049mm)--(3.7895mm,1.6096mm)--(4.2105mm,1.9009mm)--(4.6316mm,1.9660mm)--(5.0526mm,1.9892mm)--(5.4737mm,2.0000mm)--(5.8947mm,1.8859mm)--(6.3158mm,1.6279mm)--(6.7368mm,1.4525mm)--(7.1579mm,1.4519mm)--(7.5789mm,1.5111mm)--(8.0000mm,1.7738mm);}}&\fbox{\tikz{\fill[green] (8mm,2mm) circle(0.5mm);\fill[red] (5.4737mm,0mm) circle(0.5mm);\draw[line width=0.2mm, inner sep=0pt, outer sep=0pt] (0.0000mm,1.5262mm)--(0.4211mm,1.6209mm)--(0.8421mm,1.5976mm)--(1.2632mm,1.5056mm)--(1.6842mm,1.3864mm)--(2.1053mm,1.1701mm)--(2.5263mm,1.0771mm)--(2.9474mm,1.1686mm)--(3.3684mm,1.2317mm)--(3.7895mm,1.0853mm)--(4.2105mm,0.8643mm)--(4.6316mm,0.6393mm)--(5.0526mm,0.2525mm)--(5.4737mm,0.0000mm)--(5.8947mm,0.0069mm)--(6.3158mm,0.3880mm)--(6.7368mm,0.7776mm)--(7.1579mm,1.1803mm)--(7.5789mm,1.6686mm)--(8.0000mm,2.0000mm);}}&\fbox{\tikz{\fill[green] (5.8947mm,2mm) circle(0.5mm);\fill[red] (2.5263mm,0mm) circle(0.5mm);\draw[line width=0.2mm, inner sep=0pt, outer sep=0pt] (0.0000mm,0.6608mm)--(0.4211mm,0.6367mm)--(0.8421mm,0.5624mm)--(1.2632mm,0.2812mm)--(1.6842mm,0.1040mm)--(2.1053mm,0.0520mm)--(2.5263mm,0.0000mm)--(2.9474mm,0.1133mm)--(3.3684mm,0.5519mm)--(3.7895mm,0.8398mm)--(4.2105mm,1.0640mm)--(4.6316mm,1.2882mm)--(5.0526mm,1.6259mm)--(5.4737mm,1.8365mm)--(5.8947mm,2.0000mm)--(6.3158mm,1.9240mm)--(6.7368mm,1.6468mm)--(7.1579mm,1.5082mm)--(7.5789mm,1.4220mm)--(8.0000mm,1.3894mm);}}\\\end{tabular}} \\
{\small LINU } \\
{\small AI-DAX }\\ \end{tabular}};}
from pairs.
from pairs.
the ionkey file
ICONKEY.pdf
from pairs.
amd the "create pair icons" file:
create_pair_icons.pdf
from pairs.
images.csv contains a mapping of pair names to the appropriate file:
from pairs.
Related Issues (20)
- the GMV portfolio HOT 4
- pair_risk_contribution report is out of date HOT 9
- ABC: can we add implied vols or credit spreads as measures of market risk? HOT 1
- pair_risk_contribution_new: sector gross looks wrong HOT 1
- the cross product
- custom PM report HOT 3
- loading "all results" is a really bad idea HOT 1
- intraday.csv is 25mb, too large to push to git HOT 3
- 2 year correlation looks wrong HOT 1
- CIX uploads dont work HOT 4
- AC112 has no single stock positions
- pair look-through matrix has more pairs than pair P&L matrix HOT 9
- pair ACTW7 has exposure but is not in duke_pair_look_vs_outright HOT 4
- CIX uploads do not work HOT 7
- AC's position is the sum of AC and ACTW. needs to be fixed.
- James Rodgers requests
- The fund pair risk contribution table
- The correlation of my portfolio to markets
- the correlation of my pairs to one another in an easy to read format
- the look-through exposures
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pairs.