Skip to content

Instantly share code, notes, and snippets.

@darrenjrobinson
Last active January 16, 2020 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darrenjrobinson/48b29aac1c7e8644f8e35c9b3513a6c5 to your computer and use it in GitHub Desktop.
Save darrenjrobinson/48b29aac1c7e8644f8e35c9b3513a6c5 to your computer and use it in GitHub Desktop.
PowerShell Universal Dashboard React-Stockchart example. Associated blogpost here https://blog.darrenjrobinson.com/react-stockcharts-for-powershell-universal-dashboard/
import-module UniversalDashboard.Community
import-Module UniversalDashboard.UDFinancialChart
Get-UDDashboard | Stop-UDDashboard
$Theme = New-UDTheme -Name "darrenjrobinson" -Definition @{
'.dropdown-content' = @{
'min-width' = '450px'
}
'.btn-floating' = @{
'background-color' = '#26a69a'
}
'.collection .collection-item' = @{
'line-height' = '1.0rem'
'padding' = '5px 10px';
}
'.ud-grid' = @{
'color' = '#ffab40'
}
'.card, .card-panel' = @{
'color' = '#ffab40'
}
'.card .card-action a:not(.btn):not(.btn-large):not(.btn-small):not(.btn-large):not(.btn-floating)' = @{
'color' = '#ffab40'
}
} -Parent DarkDefault
$myDashboard = New-UDDashboard -Title "darrenjrobinson.com - Universal Dashboard Custom Financial Chart Component" -Content {
New-UDLayout -Columns 3 -Content {
New-UDRow -Id "FinChart1" -Endpoint {
New-UdHtml -Markup "<b>Symbol:</b> FXL 3Y - CandleStickChartWithFullStochasticsIndicator</br>"
New-UDRow -Id "CandleStickChartWithFullStochasticsIndicator" -Endpoint {
New-FinancialChart -stockData "http://localhost:10010/FXL-AX-3y.csv" -chartType CandleStickChartWithFullStochasticsIndicator
}
}
New-UDRow -Id "FinChart2" -Endpoint {
New-UdHtml -Markup "<b>Symbol:</b> FXL 1Y - MovingAverageCrossOverAlgorithmV2</br>"
New-UDRow -Id "MovingAverageCrossOverAlgorithmV2" -Endpoint {
Start-Sleep -Seconds 2
New-FinancialChart -stockData "http://localhost:10010/FXL-AX-1y.csv" -chartType MovingAverageCrossOverAlgorithmV2
}
}
New-UDRow -Id "FinChart3" -Endpoint {
New-UdHtml -Markup "<b>Symbol:</b> FXL Live - CandleStickChartForContinuousIntraDay</br>"
New-UDRow -Id "CandleStickChartForContinuousIntraDay" -Endpoint {
Start-Sleep -Seconds 1
New-FinancialChart -stockData "http://localhost:10010/FXL-AX-LiveData.csv" -chartType CandleStickChartForContinuousIntraDay
}
} -AutoRefresh -RefreshInterval 25 # Refresh the Graph
}
} -Theme $Theme
Start-UDDashboard -ListenAddress 127.0.0.1 -Port 11000 -Dashboard $myDashboard -Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment