Stock Market Visualizer Plotter Blender in Python

3D Candlestick Chart Visualization in Python:



Follow the Instructions from the Above Video then go for the Code Input:


Code in Blender Python Text Editor:



import pandas as pd
from fyers_apiv3 import fyersModel
from datetime import datetime,timedelta
import mplfinance as mpf
import warnings
import bpy
warnings.simplefilter('ignore')
client_id=open('fyersv3/app_id.txt','r').read()
token=open('fyersv3/access_token.txt','r').read().strip()
fyers=fyersModel.FyersModel(client_id=client_id,token=token,log_path='C:/Users/VIKASH/Desktop/fyers/tutorial')
days=1
symbol='NSE:NIFTYBANK-INDEX'
interval='1'
now=datetime.now()
from_date=now-timedelta(days=days)
from_date=datetime.strftime(from_date,'%Y-%m-%d')
to_date=datetime.strftime(now,'%Y-%m-%d')
data={'symbol':symbol,
      'resolution':interval,
      'date_format':'1',
      'range_from':from_date,
      'range_to':to_date,
      'cont_flag':'1'
      }
df=pd.DataFrame(fyers.history(data=data)['candles'],columns=['date','open','high','low','close','volume'])
df['date']=pd.to_datetime(df['date'],unit='s')
df['date']=df['date'].dt.tz_localize('UTC').dt.tz_convert('Asia/Kolkata')
df['date']=df['date'].dt.tz_localize(None)
df=df.set_index(df['date'])
mpf.plot(df,type='candle',style='yahoo',mav=5,volume=True,title='CandleStick Chart',show_nontrading=False,savefig='C:\\Users\\your_directory\\Desktop\\blender\\render\\candle.svg')
bpy.ops.import_image.to_plane(files=[{'name':'C:\\Users\\your_directory\\Desktop\\blender\\render\\candle.svg'}])
obj=bpy.context.selected_objects[0]
obj.location=(0,0,0)
obj.scale=(5,5,5)

Import CSV Data Renko in Blender:



Follow the Instructions from the Above Video then go for the Code Input:


Copy the data and keep in a CSV File as renko_csv.csv so you can utilize to import them in blender through Python:


movements,1,1,1,-1,-1,1
prices,51790.0,51820.0,51850.0,51820.0,51790.0,51820.0
sizes,30.0,30.0,30.0,30.0,30.0,30.0

Code in Blender Python Text Editor:



import pandas as pd
import bpy
data=pd.read_csv('C:/Users/.../Desktop/blender/renko_csv.csv',header=None)
movements=data.T[0][1:].to_list()
prices=data.T[1][1:].to_list()
sizes=data.T[2][1:].to_list()
def create_renko_bar(value,last_position,frame_start,price,size):
    if value==1:
        new_position=[last_position[0]+1,last_position[1]+1,0]
    elif value==-1:
        new_position=[last_position[0]+1,last_position[1]-1,0]
    bpy.ops.mesh.primitive_plane_add(size=1,enter_editmode=False,location=new_position)
    box_obj=bpy.context.object
    material=bpy.data.materials.new(name='RenkoMaterial')
    if value==1:
        material.diffuse_color=(0.0,1.0,0.0,1)
    elif value==-1:
        material.diffuse_color=(1.0,0.0,0.0,1)
    box_obj.data.materials.append(material)
    build_modifier_box=box_obj.modifiers.new(name='BuildBox',type='BUILD')
    build_modifier_box.frame_start=frame_start
    build_modifier_box.frame_duration=10
    
    text_loc=[new_position[0],new_position[1]+1.5,0]
    bpy.ops.object.text_add(enter_editmode=False,align='WORLD',location=text_loc)
    text_obj=bpy.context.object
    text_obj.data.body=f'P:{price}\nS:{size}'
    text_obj.scale=(0.2,0.2,0.2)
    text_obj.data.align_x='CENTER'
    
    text_material=bpy.data.materials.new(name='TextMaterial')
    text_material.diffuse_color=material.diffuse_color
    text_obj.data.materials.append(text_material)
    
    build_modifier_text=text_obj.modifiers.new(name='BuildText',type='BUILD')
    build_modifier_text.frame_start=frame_start
    build_modifier_text.frame_duration=10
    
    return new_position,frame_start+10


def create_renko_chart(movements,prices,sizes):
    position=[-3.5,-2.5,0]
    frame=1
    for i,movement in enumerate(movements):
        price=prices[i]
        size=sizes[i]
        position,frame=create_renko_bar(movement,position,frame,price,size)

create_renko_chart(movements,prices,sizes)

Automated and Customized Renko Data Visualization in Blender Python:



Follow the Instructions from the Above Video then go for the Code Input:


Code in Blender Python Text Editor:



import bpy
def create_renko_bar(value,last_position,frame_start,price,size):
    if value==1:
        new_position=[last_position[0]+1,last_position[1]+1,0]
    elif value==-1:
        new_position=[last_position[0]+1,last_position[1]-1,0]
    bpy.ops.mesh.primitive_plane_add(size=1,enter_editmode=False,location=new_position)
    box_obj=bpy.context.object
    material=bpy.data.materials.new(name='RenkoMaterial')
    if value==1:
        material.diffuse_color=(0.0,1.0,0.0,1)
    elif value==-1:
        material.diffuse_color=(1.0,0.0,0.0,1)
    box_obj.data.materials.append(material)
    build_modifier_box=box_obj.modifiers.new(name='BuildBox',type='BUILD')
    build_modifier_box.frame_start=frame_start
    build_modifier_box.frame_duration=10
    
    text_loc=[new_position[0],new_position[1]+1.5,0]
    bpy.ops.object.text_add(enter_editmode=False,align='WORLD',location=text_loc)
    text_obj=bpy.context.object
    text_obj.data.body=f'P:{price}\nS:{size}'
    text_obj.scale=(0.2,0.2,0.2)
    text_obj.data.align_x='CENTER'
    
    text_material=bpy.data.materials.new(name='TextMaterial')
    text_material.diffuse_color=material.diffuse_color
    text_obj.data.materials.append(text_material)
    
    build_modifier_text=text_obj.modifiers.new(name='BuildText',type='BUILD')
    build_modifier_text.frame_start=frame_start
    build_modifier_text.frame_duration=10
    
    return new_position,frame_start+10


def create_renko_chart(movements,prices,sizes):
    position=[-3.5,-3.5,0]
    frame=1
    for i,movement in enumerate(movements):
        price=prices[i]
        size=sizes[i]
        position,frame=create_renko_bar(movement,position,frame,price,size)
movements=[1,1,1,-1,-1]
prices=[51790.0,51820.0,51850.0,51820.0,51790.0]
sizes=[30.0,30.0,30.0,30.0,30.0]
create_renko_chart(movements,prices,sizes)

Renko Data Visualization Bar Graph Animation in Blender Python:



Follow the Instructions from the Above Video then go for the Code Input:


Code in Blender Python Text Editor:



import bpy
def create_renko_bar(value,last_position,frame_start):
    if value==1:
        new_position=[last_position[0]+1,last_position[1]+1,0]
    elif value==-1:
        new_position=[last_position[0]+1,last_position[1]-1,0]
    bpy.ops.mesh.primitive_plane_add(size=1,enter_editmode=False,location=new_position)
    material=bpy.data.materials.new(name='RenkoMaterial')
    if value==1:
        material.diffuse_color=(0.0,1.0,0.0,1)
    elif value==-1:
        material.diffuse_color=(1.0,0.0,0.0,1)
    bpy.context.active_object.data.materials.append(material)
    build_modifier=bpy.context.active_object.modifiers.new(name='Build',type='BUILD')
    build_modifier.frame_start=frame_start
    build_modifier.frame_duration=10
    return new_position,frame_start+10

def create_renko_chart(movements):
    position=[0.5,0.5,0]
    frame=1
    for movement in movements:
        position,frame=create_renko_bar(movement,position,frame)
movements=[1,1,-1,-1,1,1,-1]
create_renko_chart(movements)

Hello, World! in Blender Python:



Follow the Instructions from the Above Video then go for the Code Input:


Code in Blender Python Text Editor:



import bpy
txt = bpy.data.curves.new("HelloWorld", "FONT")
txt.body = "Hello, World!"
obj = bpy.data.objects.new("HelloWorld", txt)
bpy.context.scene.collection.objects.link(obj)

Render Candlestick Chart Visualize Using Fyers API V3 in Blender Python:



Follow the Instructions from the Above Video then go for the Code Input:


Code in Blender Python Text Editor:



import pandas as pd
from fyers_apiv3 import fyersModel
from datetime import datetime,timedelta
import mplfinance as mpf
import warnings
import bpy
warnings.simplefilter('ignore')
client_id=open('fyersv3/app_id.txt','r').read()
token=open('fyersv3/access_token.txt','r').read().strip()
fyers=fyersModel.FyersModel(client_id=client_id,token=token,log_path='C:/Users/VIKASH/Desktop/fyers/tutorial')
days=1
symbol='NSE:NIFTYBANK-INDEX'
interval='1'
now=datetime.now()
from_date=now-timedelta(days=days)
from_date=datetime.strftime(from_date,'%Y-%m-%d')
to_date=datetime.strftime(now,'%Y-%m-%d')
data={'symbol':symbol,
      'resolution':interval,
      'date_format':'1',
      'range_from':from_date,
      'range_to':to_date,
      'cont_flag':'1'
      }
df=pd.DataFrame(fyers.history(data=data)['candles'],columns=['date','open','high','low','close','volume'])
df['date']=pd.to_datetime(df['date'],unit='s')
df['date']=df['date'].dt.tz_localize('UTC').dt.tz_convert('Asia/Kolkata')
df['date']=df['date'].dt.tz_localize(None)
df=df.set_index(df['date'])
mpf.plot(df,type='candle',style='yahoo',mav=5,volume=True,title='CandleStick Chart',show_nontrading=False,savefig='C:\\Users\\your_directory\\Desktop\\blender\\render\\candle.png')
bpy.ops.import_image.to_plane(files=[{'name':'C:\\Users\\your_directory\\Desktop\\blender\\render\\candle.png'}])
obj=bpy.context.selected_objects[0]
obj.location=(0,0,0)
obj.scale=(5,5,5)

Import Stock Price Chart Images and Visualize in Blender Python:



Follow the Instructions from the Above Video then go for the Code Input:


Code in Python:



import pandas as pd
from fyers_api import fyersModel
from datetime import datetime,timedelta
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')
client_id=open('app_id.txt','r').read()
token=open('access_token.txt','r').read().strip()
fyers=fyersModel.FyersModel(client_id=client_id,token=token,log_path='C:/Users/Current_Directory')
days=1
symbol='NSE:NIFTYBANK-INDEX'
interval='1'
now=datetime.now()
from_date=now-timedelta(days=days)
from_date=datetime.strftime(from_date,'%Y-%m-%d')
to_date=datetime.strftime(now,'%Y-%m-%d')
def historical_data(symbol,interval,from_date,to_date):
    data={'symbol':symbol,
          'resolution':interval,
          'date_format':'1',
          'range_from':from_date,
          'range_to':to_date,
          'cont_flag':'1'
          }
    response=pd.DataFrame(fyers.history(data=data)['candles'],columns=['date','open','high','low','close','volume'])
    return response
hist=historical_data(symbol,interval,from_date,to_date)
plt.plot(hist['close'])
plt.tight_layout()
plt.savefig('price.png')
plt.show()

Code in Blender Python Text Editor:



import bpy
bpy.ops.object.delete(use_global=False)
bpy.ops.mesh.primitive_plane_add(size=2, enter_editmode=False, location=(0, 0, 0))
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)
bpy.ops.import_image.to_plane(files=[{"name":"price.png", "name":"price.png"}], directory="C:\\Users\\your_directory\\Desktop\\blender\\", relative=False)

Easy Installation of Python Packages in Blender:



Follow the Instructions from the Video then go for the Command

Find Path of Python Blender:


import sys
print(sys.executable)


Run CMD as Adminstrator the Set your Path as such C:\Program Files\Blender Foundation\Blender\2.80\python> and Type this Command.


Pip Installation=>  .\bin\python.exe -m ensurepip
Upgrade pip=> .\bin\python.exe -m pip install --upgrade pip
Packages Installation=>.\Scripts\pip3.exe install matplotlib


CNC(Computer Numerical Control)


Materials Required:

1)CNC Shield

2)Arduino UNO R3

3)DRV8825 Driver


Buy From Here:Robocraze CNC Shield + Arduino UNO R3 + 4 x DRV8825 Driver Kit for Arduino 3D Printer Kit | 3D Printer Project


4)Fishing Line

Buy From Here: Adeeing Braided Fishing Line 20LB-80LB Test 4 Stands Super Strong PE Fishing Line Dark Green


5)Gondola 3D Printed to BUY Low Cost 3D Printer Click Here:WOL3D ENDER 3 ORIGINAL DIY 3D PRINTER WITH RESUME FUNCTION AND EASY TO ASSEMBLE


6) 2 Cheap Bipolar Stepper Motors INVENTO Nema 17 4.2 Kg cm Bipolar Stepper Motor with 19 teeth Gear for CNC Robotics RepRap 3D Printer


7)Power Supply 12V 30A 3DPrintronics WV01RCA07884 12V 30A 350W Power Supply for 3D Printer


8)Bluetooth HC-05 Module xcluma Hc-05 Wireless Bluetooth Rf Transceiver Module Serial/Ttl/Rs232 Arduino


9)White Filaments to 3D Print Gondola WOL 3D 3D Filaments (White)