<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aziz IMGHARNE on Medium]]></title>
        <description><![CDATA[Stories by Aziz IMGHARNE on Medium]]></description>
        <link>https://medium.com/@imgh.aziz?source=rss-183a3941df54------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*D7ruMZi99hGBLFbqgEiGmA.jpeg</url>
            <title>Stories by Aziz IMGHARNE on Medium</title>
            <link>https://medium.com/@imgh.aziz?source=rss-183a3941df54------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 03:24:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@imgh.aziz/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building an Elastic Cloud Enterprise Home Lab (3×32GB / 8 vCPU) — and Why Ansible Makes It…]]></title>
            <link>https://medium.com/@imgh.aziz/building-an-elastic-cloud-enterprise-home-lab-3-32gb-8-vcpu-and-why-ansible-makes-it-38dbb5e03973?source=rss-183a3941df54------2</link>
            <guid isPermaLink="false">https://medium.com/p/38dbb5e03973</guid>
            <dc:creator><![CDATA[Aziz IMGHARNE]]></dc:creator>
            <pubDate>Sun, 21 Dec 2025 15:24:31 GMT</pubDate>
            <atom:updated>2025-12-21T15:24:31.688Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building an Elastic Cloud Enterprise Home Lab (3×32GB / 8 vCPU) — and Why Ansible Makes It Actually Enjoyable</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xYR3fE7NmxkqaMxHYMPPGg.png" /></figure><p>Running <strong>Elastic Cloud Enterprise (ECE)</strong> at home is one of the fastest ways to level up on real platform engineering: allocators, proxies, directors, system deployments, enrollment tokens, upgrades, troubleshooting, and automation. My lab is intentionally simple but realistic:</p><ul><li><strong>3 machines</strong></li><li><strong>8 vCPU / 32 GB RAM each</strong></li><li>Dedicated data path (e.g. /mnt/data)</li><li>Rocky Linux + Podman (after I struggled to make it stable on Ubuntu)</li></ul><p>The biggest lesson from my setup: <strong>do not build your ECE lab manually.</strong> You <em>can</em>, but it becomes painful fast — especially when you need to redo the lab, add nodes, change roles, or recover from partial installs. Use <strong>Ansible</strong> from day one so your lab is <strong>reproducible</strong>, <strong>debuggable</strong>, and <strong>resettable</strong>.</p><p>And when the platform is up, you access it from the Cloud UI:</p><p><strong>ECE UI URL:</strong> https://&lt;PRIMARY_HOST_IP&gt;:12443<br> (example in my lab: <a href="https://192.168.1.97:12443)">https://192.166.1.97:12443)</a></p><h3>Why I recommend Rocky + Podman (after failing with Ubuntu)</h3><p>Ubuntu can work, but in my case I didn’t succeed: I kept hitting friction points around prerequisites, privilege escalation, service readiness, and platform stability. Switching to <strong>Rocky Linux + Podman</strong> made the ECE lifecycle easier to reason about: containers, ports, and health checks became more deterministic.</p><p>This matters because ECE is not “just install and done.” The platform has a warm-up phase and multiple services that need to become healthy in the right order.</p><h3>Why manual installation is painful (and why Ansible wins)</h3><p>ECE in a home lab is basically a loop:</p><ul><li>bootstrap the primary</li><li>validate platform readiness (UI + API)</li><li>enroll additional hosts</li><li>tune roles and storage</li><li>rebuild / retest when something goes sideways</li></ul><p>Doing that manually means:</p><ul><li>repeating the same steps host by host</li><li>drifting configs (small differences you forget)</li><li>wasting time on avoidable errors (sudo, ports, wrong credentials, partial container state)</li><li>no clean “reset” button</li></ul><p>With <strong>Ansible</strong>, you get:</p><ul><li>the same install and configuration every time</li><li>easy incremental runs (--limit primary, then --limit secondary, etc.)</li><li>safer troubleshooting (you can re-run idempotent tasks)</li><li>a lab you can rebuild in minutes, not hours</li></ul><p>In short: <strong>manual is fine once.</strong> But testing ECE is about repeating the process — so automation is the whole point.</p><h3>A practical 3-node role layout for learning</h3><p>A straightforward home lab role layout:</p><ul><li><strong>Primary (Host 1):</strong> director, coordinator, proxy, allocator</li><li><strong>Host 2:</strong> director, coordinator, proxy, allocator</li><li><strong>Host 3:</strong> director, coordinator, proxy, allocator</li></ul><p>This lets you practice the full ECE surface area (platform + capacity). It’s also fine if you later split roles more cleanly (separating allocators from platform services), but this is a good starting point for a lab.</p><h3>The single readiness check that saves hours</h3><p>Before you run Ansible against secondaries or try to fetch enrollment tokens, make sure the platform API is actually ready.</p><p><strong>Ready signal:</strong></p><ul><li>401 on /api/v1/platform = platform is up (needs auth)</li><li>503 = ❌ not ready</li><li>500 = ❌ something is broken</li></ul><p>Test on the primary:</p><pre>curl -k -s -o /dev/null -w &quot;%{http_code}\n&quot; https://&lt;PRIMARY_IP&gt;:12443/api/v1/platform</pre><p>When this returns <strong>401</strong>, you’re good to proceed.</p><h3>Credentials: don’t guess, use the bootstrap secrets</h3><p>In a lab, it’s tempting to hardcode &quot;ChangeMe&quot; passwords in a playbook. But if your platform already exists, the real admin password is stored in:</p><p>/mnt/data/elastic/bootstrap-state/bootstrap-secrets.json</p><p>Extract it and use it consistently (especially for the “Get roles token / enrollment tokens” step in automation).</p><h3>Accessing the UI</h3><p>Once the primary is healthy and listening, open the Cloud UI in your browser:</p><p><strong>https://&lt;PRIMARY_HOST_IP&gt;:12443</strong></p><p>Example:</p><ul><li><a href="https://192.168.1.97:12443/">https://192.168.1.97:12443</a></li></ul><p>Log in with the admin credentials from the bootstrap secrets file.</p><h3>A reliable testing flow (the one I use now)</h3><ol><li><strong>Prep all hosts</strong></li></ol><ul><li>SSH reachable</li><li>sudo works (prefer passwordless sudo for lab automation)</li><li>/mnt/data mounted and writable</li></ul><ol><li><strong>Bootstrap primary (Ansible)</strong></li></ol><ul><li>wait until /api/v1/platform returns <strong>401</strong></li><li>validate UI is reachable on https://&lt;primary&gt;:12443</li></ul><ol><li><strong>Add hosts one by one</strong></li></ol><ul><li>run Ansible with --limit secondary</li><li>then --limit tertiary</li></ul><ol><li><strong>Validate platform and health</strong></li></ol><ul><li>UI loads</li><li>API works</li><li>key containers are healthy</li></ul><h3>Closing thoughts</h3><p>An ECE home lab is incredibly valuable, but only if you can rebuild it easily and test changes quickly. That’s why I strongly recommend Ansible over manual steps: manual installs become painful, inconsistent, and hard to troubleshoot once you start iterating.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38dbb5e03973" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Guide on how to use SMTP in O365]]></title>
            <link>https://medium.com/@imgh.aziz/guide-on-how-to-use-smtp-in-o365-9cac70fa87df?source=rss-183a3941df54------2</link>
            <guid isPermaLink="false">https://medium.com/p/9cac70fa87df</guid>
            <category><![CDATA[o365]]></category>
            <category><![CDATA[email-marketing]]></category>
            <category><![CDATA[smtp]]></category>
            <dc:creator><![CDATA[Aziz IMGHARNE]]></dc:creator>
            <pubDate>Thu, 10 Oct 2024 21:49:53 GMT</pubDate>
            <atom:updated>2024-10-10T21:49:53.530Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*UM2w6UAlK4G_ZWb_9h_Hyg.png" /></figure><p><strong>Guide on how to use SMTP in O365</strong></p><p>In your journey as a developer or data enthusiast, you’ll often find the need to automate sending emails. It may seem straightforward, but as email security has evolved, using SMTP with basic authentication has become more challenging. Major providers like Microsoft and Gmail have begun phasing out legacy authentication methods, making them harder to access.</p><p>However, the good news is that SMTP remains a powerful tool for email automation — albeit with a few hurdles to clear. While the setup process may seem daunting, this guide will walk you through the steps to configure it properly. Note that these instructions apply specifically to Office 365 accounts and do not work with free Outlook accounts.</p><p>Before you dive in, ensure that you have the necessary administrator privileges. Now, let’s explore the steps to enable and configure SMTP.</p><h3>Step-by-Step Guide to Setting Up SMTP</h3><p><strong>1. Enable Multi-Factor Authentication (MFA) on the Account:</strong></p><ul><li>Start by navigating to the <a href="https://admin.microsoft.com/#/homepage">Microsoft Admin Center</a>.</li><li>Under <strong>Active Users</strong>, locate and select the account you want to use for SMTP.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*xlw4wmPk2MBZnW6N6K3q0w.png" /></figure><ul><li>Next to your account name, click the key icon to manage your password.</li><li>Once on the account settings page, select <strong>Add sign-in method</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*ONE9lAI4mNDCSoYeh1AK9w.png" /></figure><ul><li>If you do not see the option to generate an app password, it’s likely because MFA hasn’t been enabled. Ensure MFA is activated.</li><li>Generate the app password and store it safely — this will be the password used in your code for SMTP authentication.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*183ZjROorCTa114TM1vlPg.png" /></figure><p><strong>2. Configure the Email Settings:</strong></p><ul><li>Go to the <a href="https://admin.exchange.microsoft.com/#/">Exchange Admin Center</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*QOf3SANfyBc-lPF3otdeCg.png" /></figure><ul><li>Navigate to <strong>Settings</strong>, then click on <strong>Mail Flow</strong>.</li><li>Review and configure your mail flow settings to ensure everything is aligned for SMTP to function properly.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*4r2PhIvzMa-910jkrlLjaA.png" /></figure><p><strong>3. Verify Azure Entra ID Isn’t Blocking Legacy Email Methods:</strong></p><ul><li>Head to the <a href="https://portal.azure.com/">Azure Portal</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*D9ad1Uli9Gjqt2nkMIsImg.png" /></figure><ul><li>Under <strong>Properties</strong>, scroll to the bottom and click on <strong>Manage Conditional Access</strong>.</li><li>Review any policies that could be blocking legacy SMTP protocols and disable them if necessary.</li></ul><p>By following these steps, you’ll have SMTP fully configured and ready to integrate with your applications. While the setup process may initially seem complex, mastering it unlocks powerful email automation capabilities, streamlining your workflow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9cac70fa87df" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Evaluating Cost-Effective Options for Deploying VMs(Ex:10): On-Premise vs. Cloud]]></title>
            <link>https://medium.com/@imgh.aziz/evaluating-cost-effective-options-for-deploying-vms-ex-10-on-premise-vs-cloud-c4aa8cdd5292?source=rss-183a3941df54------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4aa8cdd5292</guid>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Aziz IMGHARNE]]></dc:creator>
            <pubDate>Fri, 06 Sep 2024 23:33:05 GMT</pubDate>
            <atom:updated>2024-09-06T23:33:05.318Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Aqc5996Y7UAp1iiN.png" /></figure><p>As a data engineer or a production engineer, you’re no stranger to the need for extensive testing across various technologies and systems. Often, this requires spinning up multiple virtual machines (VMs) to create the ideal testing environment. The immediate solution that comes to mind is typically leveraging cloud providers like AWS, Google Cloud, or Azure. However, is the cloud always the most cost-effective option? In this article, we’ll explore the financial implications of deploying 10 VMs by comparing the costs associated with using a refurbished server versus cloud services.</p><h3>The Cloud Option</h3><p>Cloud computing offers unparalleled convenience and scalability. You can deploy VMs in minutes, scale up or down based on your needs, and only pay for what you use. But how does this convenience impact your budget? Let’s break down the costs for deploying 10 VMs using popular cloud providers.</p><h3>AWS EC2</h3><p>For our example, we’ll use AWS EC2 instances with 2 vCPUs and 12 GB RAM. The closest match for this configuration is the t3a.medium instance, which provides 2 vCPUs and 8 GB RAM. While not a perfect match, it allows us to approximate the costs:</p><ul><li><strong>On-Demand Pricing</strong>: €25.14 per month per instance</li><li><strong>Total Monthly Cost</strong>: €251.40 for 10 instances</li><li><strong>Annual Cost</strong>: €3,016.80</li></ul><p>AWS also offers <strong>Reserved Instances</strong> which can be more economical if you commit for a year:</p><ul><li><strong>Reserved Pricing</strong>: €20 per month per instance</li><li><strong>Total Monthly Cost</strong>: €200 for 10 instances</li><li><strong>Annual Cost</strong>: €2,400</li></ul><h3>Google Cloud Compute Engine</h3><p>For Google Cloud, the closest instance type is the e2-standard-2 with 2 vCPUs and 8 GB RAM. Here’s the cost breakdown:</p><ul><li><strong>On-Demand Pricing</strong>: €44.85 per month per instance</li><li><strong>Total Monthly Cost</strong>: €448.50 for 10 instances</li><li><strong>Annual Cost</strong>: €5,382.00</li></ul><p>Google Cloud offers <strong>Committed Use Discounts</strong> which can reduce the cost:</p><ul><li><strong>Committed Use Pricing</strong>: €33.48 per month per instance</li><li><strong>Total Monthly Cost</strong>: €334.80 for 10 instances</li><li><strong>Annual Cost</strong>: €4,017.60</li></ul><h3>The On-Premise Alternative: The Refurbished Server</h3><p>Let’s consider an alternative: purchasing a refurbished server, such as a Dell PowerEdge R720. This option involves an initial hardware cost and ongoing electricity expenses.</p><h3>Dell PowerEdge R720</h3><ul><li><strong>Initial Purchase Cost</strong>: €500</li><li><strong>Electricity Cost</strong>: Approx. €55 per month</li><li><strong>Total Annual Electricity Cost</strong>: €660</li><li><strong>Annual Total Cost</strong>: €500 (initial) + €660 (electricity) = €1,160</li></ul><h3>Capacity Calculation</h3><p>The Dell PowerEdge R720 can support up to 10 VMs with 2 vCPUs and 12 GB RAM each, based on the following calculations:</p><ul><li><strong>CPU</strong>: 20 logical CPUs available; supports up to 10 VMs (2 vCPUs each)</li><li><strong>RAM</strong>: 256 GB available; supports up to 21 VMs (12 GB each)</li></ul><h3>Comparing Costs: On-Premise vs. Cloud</h3><h3>1-Year Cost Summary</h3><p><strong>OptionCostDell PowerEdge R720</strong> (including electricity)€1,160<strong>AWS EC2 (On-Demand, 10 instances)</strong>€3,016.80<strong>AWS EC2 (Reserved, 10 instances)</strong>€2,400<strong>Google Cloud (On-Demand, 10 instances)</strong>€5,382.00<strong>Google Cloud (Committed Use, 10 instances)</strong>€4,017.60</p><h3>Conclusion</h3><p>The cloud offers flexibility and scalability but comes with a higher price tag. For a year-long deployment of 10 VMs:</p><ul><li><strong>AWS EC2 Reserved Instances</strong> provide a cost-effective cloud option at <strong>€2,400</strong> annually.</li><li><strong>Google Cloud</strong> is more expensive, with costs ranging from <strong>€4,017.60</strong> (committed use) to <strong>€5,382.00</strong> (on-demand).</li><li><strong>Dell PowerEdge R720</strong>, with an initial investment of <strong>€500</strong> and annual electricity costs totaling <strong>€660</strong>, is the most economical option for long-term use, with an annual cost of <strong>€1,160</strong>.</li></ul><p>For engineers who need to deploy multiple VMs for extended periods, investing in on-premise hardware like the Dell PowerEdge R720 could be a more cost-effective solution compared to cloud services. However, if you need the agility and scalability of the cloud for shorter-term projects or variable workloads, the flexibility of cloud services might justify the higher cost.</p><p><strong>Getting a server at home can be a fun and rewarding experience</strong>, offering hands-on management and control. But it’s worth noting that it comes with some trade-offs, including <strong>noise</strong> from the server’s cooling fans and other operational sounds. If you’re prepared for the noise and enjoy the hands-on aspect of hardware management, the on-premise route could be an exciting and budget-friendly option.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4aa8cdd5292" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Erasure Coding VS Replication]]></title>
            <link>https://medium.com/@imgh.aziz/erasure-coding-vs-replication-546e9150fa93?source=rss-183a3941df54------2</link>
            <guid isPermaLink="false">https://medium.com/p/546e9150fa93</guid>
            <category><![CDATA[replication]]></category>
            <category><![CDATA[erasure-coding]]></category>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[minio]]></category>
            <dc:creator><![CDATA[Aziz IMGHARNE]]></dc:creator>
            <pubDate>Mon, 12 Aug 2024 16:37:00 GMT</pubDate>
            <atom:updated>2024-08-12T16:37:00.784Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*m60GnS27ZQWUlsr3.png" /></figure><p>In this article, I will discuss two mechanisms in the world of data that allow for fault tolerance and ensure high availability: replication and erasure coding. I’ll compare these methods using examples and simple analogies.</p><p>To begin, let’s consider a file named text.txt with the content “Aziz is in medium.” Suppose we have four disks available, and we store the text in four separate chunks :</p><ul><li><strong>Chunk 1:</strong> text_1.txt contains “Aziz” and is stored on disk 1.</li><li><strong>Chunk 2:</strong> text_2.txt contains “is” and is stored on disk 2.</li><li><strong>Chunk 3:</strong> text_3.txt contains “in” and is stored on disk 3.</li><li><strong>Chunk 4:</strong> text_4.txt contains “medium” and is stored on disk 4.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*CMAqWvMA6WEMKpMB.png" /></figure><p>By splitting the data into multiple chunks, it becomes easy to distribute and retrieve. However, this approach is not fault-tolerant — losing one disk means losing part of the data. So, how can we make it fault-tolerant? There are two effective methods:</p><p><strong>Replication:</strong></p><p>The first and simplest method is replication, which involves storing an exact copy of the data on another disk. If we apply this to our example, we would need four additional disks to store exact copies of the original chunks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Fyp_VrdwLfQYl-HM.png" /></figure><p>While this method is straightforward, it is also expensive, requiring 100% additional storage to ensure data persistence. However, this setup would protect the data even if up to four disks fail.</p><p><strong>Erasure Coding:</strong></p><p>Let’s explore erasure coding with an example. Imagine we add two extra disks to our original setup. Instead of storing exact copies of the chunks, we store computed combinations:</p><ul><li><strong>Extra Chunk 1:</strong> text_extra1.txt contains “Aziz is in” and is stored on extra disk 1.</li><li><strong>Extra Chunk 2:</strong> text_extra2.txt contains “in medium” and is stored on extra disk 2.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*lSCnLvzSPlqh_ZHF.png" /></figure><p>Notice that this time, we didn’t store exact copies, but rather a computed combination of the original chunks. The magic of erasure coding is that even if you delete any two of the chunks (including the extra ones), you can still reconstruct the original sentence. For example, if you lose “Aziz” and “in,” you can use Chunk 4 and Extra Chunk 1 to recover the data. Amazing, right?</p><p>Technically speaking, erasure coding allows us to build a fault-tolerant system that ensures data persistence even with the loss of two disks.</p><p>However, there is a downside. The data in erasure coding is calculated using matrix operations, where the variables are the number of initial chunks. In our case, to tolerate the loss of two disks, we needed four initial equations (or chunks). To tolerate the loss of four disks, we would need four additional disks.</p><p><strong>Devil’s Advocate:</strong></p><p>You might wonder, “If I need the same number of disks to tolerate the loss of four disks, why bother with the math?” The answer is that erasure coding doesn’t require the same amount of main storage to be fault-tolerant; it depends on your specific needs. Moreover, with erasure coding, you can lose any combination of disks and still maintain data integrity, whereas with replication, if you lose both the main chunk and its replica, you lose the data with just the loss of two disks.</p><p><strong>Conclusion:</strong></p><p>Erasure coding offers a more flexible and efficient approach to fault tolerance compared to replication, but can’t be explained in one article …</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=546e9150fa93" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Vector Search may make you less happy?]]></title>
            <link>https://medium.com/@imgh.aziz/why-vector-search-may-make-you-less-happy-0aec2d45ee1c?source=rss-183a3941df54------2</link>
            <guid isPermaLink="false">https://medium.com/p/0aec2d45ee1c</guid>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[vector-database]]></category>
            <dc:creator><![CDATA[Aziz IMGHARNE]]></dc:creator>
            <pubDate>Thu, 25 Jul 2024 00:29:29 GMT</pubDate>
            <atom:updated>2024-07-25T00:29:29.359Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VVdb0zolSFSaBTAAg_NY6g.jpeg" /></figure><p>In essence, search methodologies can be categorized into two primary types: lexical search and vector search.</p><h3>Lexical Search:</h3><p>As the term implies, lexical search relies on language and the matching of words or their roots. This traditional approach is what most people envision when thinking about search functionality. However, it necessitates a lexical component, meaning you can only compare text against text. Consequently, you cannot search for an image within a list of videos or an a cappella track in a playlist since there’s no lexical component involved. The main considerations in this scenario revolve around the choice of database and search engine and how to scale them, which, while not trivial, are limited to a few key questions.</p><h3>Vector Search:</h3><p>Vector search, on the other hand, operates on a fundamentally different principle. Instead of using lexical components, it deals with mathematical vectors (or embeddings, if you prefer). When executing a search query, the system searches for other vectors that are “near” the queried vector. This may sound like a simple replacement of lexical elements with vectors, but the innovation of vector search lies in its ability to transform anything into a vector. This transformation solves numerous problems and opens up a myriad of use cases:</p><ul><li><strong>Search anything against anything</strong>: For instance, you could search for an image within book titles or retrieve a person’s record based on their picture.</li><li><strong>Search for meaning instead of lexical existence</strong>: This allows for a deeper, more nuanced search capability.</li></ul><h3>The Magic Behind Vectorization:</h3><p>The key to turning “anything” into a vector is machine learning, specifically ML embedding models. These models are trained to generate mathematical representations of given inputs. There is a vast array of models available, and you can even develop your own. However, this abundance can be a double-edged sword: selecting the right model involves ensuring it fits your vector database’s dimensions and that your infrastructure can support it, among other considerations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*Gmv1ZBzzKX5Zgozd.png" /><figcaption>Source: <a href="https://dev.to/pavanbelagatti/wtf-is-a-vector-database-a-beginners-guide-16p">https://dev.to/pavanbelagatti/wtf-is-a-vector-database-a-beginners-guide-16p</a></figcaption></figure><h3>Question you need to answer</h3><p>In order to effectively implement vector search in your infrastructure, you will need to address, among others, the following questions:</p><h4>Database-Related:</h4><ul><li><strong>Type</strong>: What type of database or indexing system will you use (e.g., Faiss, Annoy, HNSW)?</li><li><strong>Sizing</strong>: What are the storage and performance requirements for your database?</li></ul><h4>Model-Related:</h4><ul><li><strong>Model</strong>: Which embedding model or technique will you use to generate vectors?</li><li><strong>Model Vector Representation</strong>: What is the vector representation provided by your model (e.g., dimensionality, type of embeddings)?</li><li><strong>Updates</strong>: How will you manage updates to the embedding models or vector data?</li><li><strong>Open Source</strong>: Is the model or tool you’re using open source, and if so, does it meet your requirements?</li><li><strong>Size</strong>: What is the size of the model, and how will it impact performance and resource requirements?</li><li><strong>Infrastructure Sizing</strong>: What infrastructure will you need to support the model, including computational resources and storage?</li></ul><h4>Vector-Related:</h4><ul><li><strong>Dimension</strong>: How many dimensions will your vectors have, and how does this affect performance and accuracy?</li><li><strong>Similarity Metric</strong>: What similarity metric will you use to compare vectors (e.g., cosine similarity, Euclidean distance)?</li></ul><h3>Conclusion:</h3><p>Vector search can be viewed as an additional layer that enhances search results. However, it introduces a dependency on embedding models during both data ingestion and querying processes, which can create a bottleneck. For example, if your database can ingest 10 records per minute, but your model can only generate one document per minute, your system will only be as fast as the slowest component.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0aec2d45ee1c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Elastic vs. OpenSearch — From an Elastic User’s Point of View]]></title>
            <link>https://medium.com/@imgh.aziz/elastic-vs-opensearch-from-an-elastic-users-point-of-view-738d03b49969?source=rss-183a3941df54------2</link>
            <guid isPermaLink="false">https://medium.com/p/738d03b49969</guid>
            <category><![CDATA[opensearch]]></category>
            <category><![CDATA[kibana]]></category>
            <category><![CDATA[elastic]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <dc:creator><![CDATA[Aziz IMGHARNE]]></dc:creator>
            <pubDate>Mon, 22 Jul 2024 23:19:54 GMT</pubDate>
            <atom:updated>2024-07-23T07:03:07.604Z</atom:updated>
            <content:encoded><![CDATA[<h3>Elastic vs. OpenSearch — From an Elastic User’s Point of View</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wYISanqWdFOM-wPyauFftQ.png" /></figure><p>Coming from a background in Elastic/Elasticsearch, I’ve grown quite adept at utilizing the technology on a large scale, following its educational paths, and earning certifications in all its aspects. Elastic offers a vast array of features and has become increasingly user-friendly as their UI evolves. However, these advancements come at a cost, as accessing many of the advanced features requires purchasing licenses. This naturally raises the question: Is it worth the expense?</p><p>To answer this, I decided to compare it with other products on the market, starting with OpenSearch, which is open-source and free. This article marks the beginning of my exploration, and I will continue to enrich it with my findings as I delve deeper into testing and discovery.</p><h3><strong>What is Opensearch?</strong></h3><p>OpenSearch is an open-source search and analytics suite derived from Elasticsearch 7.10. It was created after Elastic changed the licensing model of Elasticsearch and Kibana from open source to a dual license (SSPL and Elastic License) in January 2021. OpenSearch is developed and maintained by the OpenSearch community, with significant contributions from Amazon Web Services (AWS).</p><h3><strong>Getting the hands dirty</strong></h3><h3><strong>User Friendly Setup Comparison</strong></h3><h3><strong>Use Case: Setup Demo</strong></h3><blockquote>This scenario involves quickly setting up an instance of a search engine to start exploring its features. Surprisingly, OpenSearch is much easier to set up with minimal steps, and it can be done without much knowledge of node architecture.</blockquote><blockquote><strong>OpenSearch Case</strong></blockquote><blockquote>In OpenSearch, the setup steps are straightforward:</blockquote><blockquote>1. Download binaries for OpenSearch and OpenSearch Dashboards.</blockquote><blockquote>2. Set the admin password for OpenSearch.</blockquote><blockquote>3. Install and enable OpenSearch as a service.</blockquote><blockquote>4. Install and enable OpenSearch Dashboards as a service.</blockquote><blockquote>Detailed instructions can be found [here](https://opensearch.org/docs/latest/install-and-configure/install-opensearch/debian/).</blockquote><blockquote><strong>Elasticsearch Case</strong></blockquote><blockquote>Setting up a demo account in Elasticsearch may be slightly more challenging due to the documentation:</blockquote><blockquote>1. Download binaries for Elasticsearch and Kibana.</blockquote><blockquote>2. Install Elasticsearch and save the generated password.</blockquote><blockquote>3. Regenerate the password for the admin, if necessary.</blockquote><blockquote>4. Test if Elasticsearch is running correctly (status is green).</blockquote><blockquote>5. Generate the enrollment token for Kibana.</blockquote><blockquote>6. Install Kibana using the enrollment token.</blockquote><blockquote>The presence of an enrollment token, which contains Kibana settings to connect to Elasticsearch, can be less beginner-friendly because it often requires troubleshooting.</blockquote><blockquote>Detailed instructions can be found [here](<a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.17/deb.html">https://www.elastic.co/guide/en/elasticsearch/reference/7.17/deb.html</a>).</blockquote><h3><strong>Use Case: GUI Lovers</strong></h3><blockquote>While the two interfaces are almost identical, the features offered in Kibana are more extensive and ergonomically organized. Nevertheless, OpenSearch offers almost all essential features for observability and search use cases. Kibana is ahead in other plugins, particularly with its products, where it offers seamless interaction with Logstash and agents that you can configure in Kibana. This is not the case for OpenSearch Dashboards.</blockquote><h3>Comparison tables</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*dWcYtej4b0pKbyd7a5Dq4g.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=738d03b49969" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ABCs of Crypto Trading -A collection of definitions that you need to know]]></title>
            <link>https://wire.insiderfinance.io/abcs-of-crypto-trading-a-collection-of-definitions-that-you-need-to-know-6190a21eb7cc?source=rss-183a3941df54------2</link>
            <guid isPermaLink="false">https://medium.com/p/6190a21eb7cc</guid>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[Aziz IMGHARNE]]></dc:creator>
            <pubDate>Sun, 24 Oct 2021 12:27:19 GMT</pubDate>
            <atom:updated>2021-10-28T16:10:22.999Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aanFBpjYpKXrEwk07JdZ1A.png" /></figure><p>In this article, I have collected a comprehensive list of keywords, that you often hear in crypto discussions, with their definition, examples, and FAQs.</p><h3><strong>General:</strong></h3><p><strong>Cryptocurrency:</strong>(aka coin)is a digital currency, generally referred to by a symbol of 3 to 4 characters.</p><blockquote>Example: Bitcoin is referred to by BTC, Ether is referred to by ETH. There endless number of coins in the market. Binance alone has +500 token traded in it</blockquote><p><strong>Trading PAIR:</strong> or trading pair is pair of 2 cryptocurrencies, which you can trade one against the other.</p><blockquote>Example: BTCETH is a pair that consist of bitcoin and ether. if you want to buy bitcoin in an exchange(Ex binance) using ether , u need to check if this exchange has BTCUSDT pair.</blockquote><p><strong>Exchange:</strong> is the platform where you can trade your coins and their derivatives (check definition below)</p><blockquote>Example: some of wellknown exchanges are: Binance and Coinbase.</blockquote><p><strong>Shitcoin:</strong> is a coin that is created with no valid use case. It is created as a meme and derives its value from the value that people give it</p><blockquote>There are more shit coins in the realm of cryptos than there legit ones.</blockquote><p><strong>USE CASE: </strong>The project that a coin is created for. In other words, it is the answer to “why this coin exists”</p><blockquote>Example: Chain is a coin that is created to decentralise betting in esports game and this is its use case.</blockquote><p><strong>MARKET CAP: This is</strong> the total dollar value of the available coin in the market</p><p><strong>SUPPLY:</strong> The number of units of a coin that are available in the market.</p><p><strong>VOLUME:</strong> The dollar value of coins in circulation during a time frame. Volume should always be followed by timeframe, For instance, “Volume in 24h”</p><p><strong>Positions: </strong>refers to what you possess. Your coin position is how much to that coin you possess</p><h3>Prices:</h3><p>In this part will agree on “time frame”, which is the time increment at which we are monitoring a certain coin.</p><p><strong>Last:</strong> is the last price at which a coin is traded</p><p><strong>0pen:</strong> is the price at the start of the time frame. If you don’t indicate the time frame open often means the price at the open of 24 hours. in other words price 24 hours ago.</p><p><strong>Close:</strong> is the price at the end of the time frame.</p><p><strong>High:</strong> is the maximum price during a time frame.</p><p><strong>Low: </strong>is the minimum price during a time frame.</p><p>In a trading chart, these 4 elements are presented by what is known as a candle(Japanese candle).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/0*dDZcq9mohfV2kEAK.png" /></figure><p>In this image, we have to candles:</p><p>Green candles: where the price went up in the timeframe: close price was more than the open price.</p><p>Green candles: where the price went down in the timeframe: close price was less than the open price.</p><p><strong>Bid price:</strong> the price that buyers of a coin are offering.</p><p><strong>Ask price:</strong> the price that sellers of a coin are asking for.</p><h3>Orders and type of orders:</h3><p>Orders are your way to interact with the market. It is what you use to create your offers on the market. The exchange then takes your offer and tries to match it convenient opposite offer. For example: if you want to buy bitcoin but you set your maximum price for 1 dollar, you would have to create a limit buy order and the exchange(broker ) will try to match you with whoever want to sell for less or equal to 1 dollar.</p><p>There are plenty of types of orders, but the basic ones are:</p><p><strong>Limit buy order: </strong>an order where you define the quantity you want to buy and the maximum price you want to pay for a unit. This order will only get filled If it finds an offer with less or equal to the limit defined price.</p><p><strong>Limit sell order: </strong>an order where you define the quantity you want to sell and the maximum price you want to pay for a unit. This order will only get filled If it finds an offer with more or equal to the limit-defined price.</p><p><strong>Market order: </strong>an order where you would buy or sell a certain amount of coin at whatever unit price is available in the market( yes you guessed a risky order).</p><p>There are plenty of other types of orders that are created by exchanges to allow users to manage their risk. For instance: Take profit, stop loss, OCO one cancel the other …</p><p>We will cover those in the next articles.</p><h3>Twitter : <a href="https://twitter.com/aimgharne">@AImgharne</a></h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6190a21eb7cc" width="1" height="1" alt=""><hr><p><a href="https://wire.insiderfinance.io/abcs-of-crypto-trading-a-collection-of-definitions-that-you-need-to-know-6190a21eb7cc">ABCs of Crypto Trading -A collection of definitions that you need to know</a> was originally published in <a href="https://wire.insiderfinance.io/">InsiderFinance Wire</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Streaming stock news through Interactive brokers TWS API]]></title>
            <link>https://medium.com/@imgh.aziz/streaming-stock-news-through-interactive-brokers-tws-api-c74887558990?source=rss-183a3941df54------2</link>
            <guid isPermaLink="false">https://medium.com/p/c74887558990</guid>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[ibkr]]></category>
            <category><![CDATA[interactive-brokers]]></category>
            <dc:creator><![CDATA[Aziz IMGHARNE]]></dc:creator>
            <pubDate>Sat, 23 Oct 2021 11:07:25 GMT</pubDate>
            <atom:updated>2021-10-23T11:07:25.400Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cAYCrBIblPAYLWPP42QFAw.png" /></figure><p>If you are reading this, there is a high chance that you hit a wall trying to stream news from TWS API. Good news: you will be able to solve that problem after reading this article. Bad news: there are a lot of constraints that go along with it.</p><h3><strong>For Lazy folks:</strong></h3><p>If you are too lazy to read the whole article you can clone the GitHub repo found at the bottom of this page, use the TWS beta version and you will be good to stream the data live from IBKR.</p><h3>For non Lazy folks:</h3><p>Before jumping into the technicalities let me give you some context:</p><p>In order to perform some machine learning algorithm on stocks news, it was mandatory for me to find a way to get headlines. So I head to the oldest exchange/broker out there, which is Interactive brokers. I had this idea in mind: if these guys have been in the market for so long, they must have a robust app and their API should be flawless. To my surprise it was far from that: the API is hard to navigate through and not beginners friendly.</p><p>I had to get in touch with the support, who couldn’t sometimes run their own code, numerous times before coming to the results and conclusion that I am listing in this article.</p><h3><strong>Results:</strong></h3><ol><li>The news that you see in TWS comes from different sources, for instance, Benzinga and DJ. They are streamed for you for free in your desktop app</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*h6W-W-IuUBxHlSDR.png" /></figure><p>2. If you try to stream the news through API you will only get some general news for free. In order for you to get the same stream as TWS, you need to subscribe to every source that you’d want to see in your app.</p><p>3. Sources are very expensive to subscribe to, for instance:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ICkGxQDZReeC-lTS7MLlGQ.png" /></figure><p>4. If you follow the exact documentation on their website you might not get the news. You need to use the beta TWS (Apparently it is not working on the stable version)</p><h3>How do you get live news:</h3><p>Enough talk let’s get into some technicalities:</p><p>All you need to do is to install Python (version 3 and above) and install<a href="https://pypi.org/project/ibapi/"> IBapi library</a>.</p><p>After that download the code that I have linked in this Repo</p><p>You need to add news sources, that you are subscribed to, to the list in the config file and you will be good to go. An example is included in the config file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yk5LKu7FovQWoH1K9OmN0g.png" /></figure><blockquote>Open TWS<em>-Make sure it is &gt;Version 10.11.1q-</em>, go to API settings, make sure you enable sockets connexion. Make also sure that the port there is the same as in config.py file</blockquote><p>Now head back to the Repo folder and run <em>live news.py</em>.</p><p>If everything was done accordingly, you should see this output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*I1uNrprviYoiaaphpc074A.png" /></figure><p>Wait for a few minutes and you will see news flowing in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pGr_DigkBvRth73q0KXutQ.png" /></figure><h3>Github Rep:</h3><p><a href="https://github.com/azizimgh/IBKR-News-streaming.git">https://github.com/azizimgh/IBKR-News-streaming.git</a></p><p>Made it this far, might as well follow me on Twitter: <a href="https://medium.com/twitter.com/aImgharne">@AImgharne</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c74887558990" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I created an Imessage Trading APP in 1 hour]]></title>
            <link>https://medium.com/@imgh.aziz/i-created-an-imessage-trading-app-in-1-hour-5972ea313676?source=rss-183a3941df54------2</link>
            <guid isPermaLink="false">https://medium.com/p/5972ea313676</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Aziz IMGHARNE]]></dc:creator>
            <pubDate>Tue, 12 Oct 2021 16:47:11 GMT</pubDate>
            <atom:updated>2021-10-13T21:08:32.784Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Da9vhRzxa92HZavBJzmxeQ.png" /></figure><blockquote><em>If you are in rush to get the code, skip to the bottom where you will find the link to github repo</em></blockquote><h3>What is it?:</h3><p>This is a simple app based on imessage to order spot trades from binance.</p><h3>How it works:</h3><p>From your iMessage you send an order in the following format: “typeOfOrder Symbol Amount Price(Optional)’’. That’s it, the code will take it from here and will send you feedback.</p><p>Supported types of orders are: Buy and sell with the possibility of using limit order by adding a field with the limit price.</p><h3>Example:</h3><p><em>To the left:</em> I sent a market order to buy 10 coins of “xxx”. Since there is no coin with that name. I got non-valid symbol feedback.</p><p><em>In middle:</em> I tried to buy 5 units of xrp, but binance doesn’t allow orders where the amount is less than 5 usd. Therefore i placed an order, but this time with 10 xrp(order value &gt;10 usd)</p><p><em>To the right:</em> I tried to buy 5 units of xrp, but binance doesn’t allow orders where the amount is less than 5 usd. Therefore i placed an order, but this time with 10 xrp(order value &gt;10 usd)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*jYVxLGUJ18r-nARW_107zg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*DKghXZrOlxMmOLNTFpgV9A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*W2Bnbu_POxB5n_uVKMcg_A.jpeg" /><figcaption>z</figcaption></figure><h3><strong>Pre-requisites:</strong></h3><h4>To use it:</h4><blockquote>To use this you will Entry level knowledge of: Api , spot orders and vps (to deploy your app)</blockquote><blockquote>You will also need to get sendblue.co subscription in order to get api keys.</blockquote><blockquote>The process is simple: clone the repository, change the keys in config file( both sendblue and binance keys). After that upload your app on some vps run main.py. From that latter you will get your vps ip, add “/webhook” to it and paste it in your <a href="http://sendblue.co/">sendblue</a> dashboard.</blockquote><blockquote>That is it!</blockquote><h4>To develop upon it:</h4><p>Packages and frameworks:</p><blockquote>Python 3.7 , Flaskn, Pyhon-binance( A binance Api wrapper)</blockquote><p>Hosting:</p><blockquote>I use gcloud, but you can use whatever you want. You can’t use local host since you will have to provide a webhook link to sendblue.</blockquote><h3>How I created it:</h3><ol><li>I started with a binance handler where I have defined 4 buy function</li></ol><pre>class binance_handler:<br>    def __init__(self):<br>        self.cl = Client(api_key ,api_secret)<br>    def buy_market(self,coin,amount):<br>        print(&quot;buy&quot;)<br>        try :<br>            self.cl.order_market_buy( symbol=coin.upper() +&quot;USDT&quot;, quantity=amount)<br>            return False<br>        except Exception as e: return str(e)<br>    def sell_market(self,coin,amount):<br>        try:<br>            self.cl.order_market_sell(symbol=coin.upper() + &quot;USDT&quot;, quantity=amount)<br>            return False<br>        except Exception as e:<br>            return str(e)<br>    def buy_limit(self,coin,amount,price):<br>        try:<br>            self.cl.order_limit_buy(symbol=coin.upper() + &quot;USDT&quot;, quantity=amount,price=price)<br>            return False<br>        except Exception as e:<br>            return str(e)<br>    def sell_limit(self,coin,amount,price):<br>        try:<br>            self.cl.order_limit_sell(symbol=coin.upper() + &quot;USDT&quot;, quantity=amount, price=price)<br>            return False<br>        except Exception as e:<br>            return str(e)</pre><p>2. I created a sendblue class that will be responsible to send feedback after the order placing</p><p>3. In my main file i have created my flask app that will handle two requests:</p><p>3.1 Get: Just to make sure the app is up</p><p>3.2 Post: This will parse the hook sent from sendblue, it will get the content of the message and phone number and pass to Execute message function.</p><p>This function will analyze the 4 cases we have defined and choose the appropriate function to call from binance handler. Once this is accomplished it will call the respond back function in order to send feedback to the user.</p><h3>Main code:</h3><pre>from flask import Flask, request<br>import json<br>from send_blue_handler import send_handler<br>from binance_orders import *<br><br>sender = send_handler()<br>buyer = binance_handler()<br>app = Flask(__name__)<br><br>def respond_back(state_of_order,number):<br>    print(state_of_order)<br>    if not state_of_order: sender.send_message(&quot;Order placed successfully&quot;, number)<br>    else: sender.send_message(&quot;Order not placed for this reason&quot; + str(state_of_order), number)<br><br>def execute_message(message,number):<br>    print(message)<br>    splitted = message.split(&quot; &quot;)<br>    print(splitted)<br>    #checking for market orders<br>    if len(splitted) == 3 and splitted[0].strip().lower() == &quot;buy&quot;:<br>        respond_back(buyer.buy_market(splitted[1].strip().upper(),float(splitted[2].strip().lower())),number)<br>    if len(splitted) == 3 and splitted[0].strip().lower() == &quot;sell&quot;:<br>        respond_back(buyer.buy_market(splitted[1].strip().upper(),float(splitted[2].strip().lower())),number)<br>    # checking for limit orders<br>    if len(splitted) == 4 and splitted[0].strip().lower() == &quot;buy&quot;:<br>        respond_back(buyer.buy_limit(splitted[1].strip().upper(), float(splitted[2].strip().lower()),float(splitted[3].strip().lower())),number)<br>    if len(splitted) == 4 and splitted[0].strip().lower() == &quot;sell&quot;:<br>        respond_back(buyer.sell_limit(splitted[1].strip().upper(), float(splitted[2].strip().lower()),float(splitted[3].strip().lower())),number)<br><br>@app.route(&#39;/&#39;, methods=[&#39;GET&#39;])<br>def index():  return (&#39;&lt;h1&gt;Trade by message is up and running&lt;/h1&gt;&#39;, 200, None)<br><br>@app.route(&#39;/order&#39;, methods=[&#39;POST&#39;])<br>def catch_webhook():<br>    try:<br>        content, from_number = json.loads(request.data)[&#39;content&#39;], json.loads(request.data)[&#39;from_number&#39;]<br>        execute_message(content,from_number)<br>        return { &quot;code&quot; : &quot;succes&quot; }<br>    except Exception as e: return  { &quot;code&quot;: str(e)}<br><br>if __name__ == &#39;__main__&#39;:<br>    app.run(host =&#39;0.0.0.0&#39;)</pre><h3>Areas of improvement:</h3><p>There is so much to enhance in this code:</p><p>=&gt; Add other exchanges</p><p>=&gt; Allow other types orders</p><p>=&gt; integrate derivatives</p><p>=&gt; Add another layer of order verification( check if the imessage was received on time or late)</p><h3>Link to the GitHub repo:</h3><p><a href="https://github.com/azizimgh/tradeBmessage.git">https://github.com/azizimgh/tradeBmessage.git</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5972ea313676" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Best practices before scraping a website]]></title>
            <link>https://medium.com/@imgh.aziz/best-practices-before-scraping-a-website-58cb03a6a9f9?source=rss-183a3941df54------2</link>
            <guid isPermaLink="false">https://medium.com/p/58cb03a6a9f9</guid>
            <category><![CDATA[websocket]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Aziz IMGHARNE]]></dc:creator>
            <pubDate>Mon, 11 Oct 2021 11:32:26 GMT</pubDate>
            <atom:updated>2021-10-11T11:37:02.737Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VYz3qqjdts4uLrvtCKcLTA.png" /></figure><p>Web scraping is defined as the process of getting the data from a website using bots. It may be used for:</p><p>=&gt; Collecting the data for data engineering-related tasks</p><p>=&gt; Getting updated and push them to your side</p><p>=&gt; Monitor a commercial website to jump on a product release</p><h3>What do we do wrong?</h3><p>In our web scraping journey, we are often tempted to jump on the classical ways that our minds link to the word “scraping”. Namely:</p><ol><li>Using HTTP requests to get the HTML from the website and parsing via some package (Ex beautiful soup)</li><li>Using headless browsers for dynamic websites</li></ol><p>While those methods are often effective, they might sometimes be overcomplicated and may lead to an undesired outcome. Such as getting your Ip banned by the website.</p><h3>So what are you suggesting?</h3><p>Let us make an analogy here: Think of a website as a house. Our purpose is to get into that house and take pictures of its elements. There are several ways to that:</p><p>1/ Try to get to the house from the public door and take pictures (this is requesting HTML in our case). The downside of this is that the owner may kick you out if they notice strange behavior from your side. An example might be walking too fast inside the house (too many requests).</p><p>2/ Ask the owner if they offer the possibility of giving you pictures when you ask for them (API in our case). This might be free, paid or a combination of both. If they do offer this service they will set some limitations for you, for instance, how many requests you make in a day( Max requests).</p><p>This is an effective way that will save a good amount of time( the time you would spend taking pictures). Nonetheless, it has one downside: You will need to ask the owner each time for pictures.</p><p>3/ If the owner is too generous he would open a two-side communication protocol. Where he would let request pictures and he will send a new one if he takes it. This is achieved via WebSockets.</p><h3>Moral of the analogy</h3><p>Before web scraping data from a website, you would be better off if you check they have a WebSocket. If they don’t, then consider looking for their API( Many platforms have developer portals where they offer access to their API)</p><h3>I get it now, but how do I use WebSocket and Api?</h3><p>Don’t panic, you will find many useful articles on my blog on how you can use API and WebSockets. <a href="https://medium.com/@imgh.aziz">Check this out</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58cb03a6a9f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>